diff --git a/CHECKSUMS.txt b/CHECKSUMS.txt index 709199f0673d691fc0909b91052e4d78356836af..cd451544ba17b3705929e8b4edab10b0e1764d4b 100644 --- a/CHECKSUMS.txt +++ b/CHECKSUMS.txt @@ -1,23 +1,23 @@ -Cover Charge v0.3.12.211: 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.211. +Cover Charge v0.3.12.212: web apps, plus the Cover Charge for Display tablet app for Android (downloads/android/, its SHA-256 is in downloads/android/SHA256.txt). No phone APKs were built for v0.1.2 to v0.3.12.212. SHA-256 of each web app's start page, service worker, manifest and logo: -db82bdc370d23215bc2cd6782d6ff788c0dc5d59cf5d57142104cf22cb13f2b0 owner-app/index.html -58150643bdce4d421d15db238214d20b8b8d9bd350745b68f8216cf66a28c326 owner-app/sw.js +1de761c85f3e4512e68d5c0f2cbaae7455e35124d2ffba70f22e35d598fdbd4b owner-app/index.html +34fb7f64a54514c82af9d9947be1caabac6075d3e8d4b47c9a39e17efdf9c2a2 owner-app/sw.js e305c44d11a9c25f37372f3fa4d329d4ffb04df2edee6e7b4b9ac91f3875ac67 owner-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 owner-app/brand-logo.png -ab813b0eee08a8e0652fa000b6e08b96aab1837eeab3028c98aa13d20b637eb5 staff-app/index.html -a9091abc0b2ba4270f9deba8fb960b0e0c4b3c0738d9dda30247cd54383e730d staff-app/sw.js +c44f32ab84f906a1233db6981c79270f4e59b8f8370fb78084967862a26dbd76 staff-app/index.html +0cf78b293b462518247aae6411e1217475290c8f360a66d00d18ae8082de2566 staff-app/sw.js bd1d310ebf8e2a80808e100c41fb7fe1c4369d3026478f3ad8eececaeadaf4ac staff-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 staff-app/brand-logo.png -cdfdf4103584fac20a2d0317a27743cf4360c16f5bf6fcae614f5e507577df83 customer-app/index.html -23efdb3e091e22a1446e44e5ba96d687ef4e866950d801607d851230dd4e3b20 customer-app/sw.js +fe2c8b97c0d229039b65e60401b69f337e948f54bdaaeb24a73574ba11b18c4f customer-app/index.html +66345515cd959840823c53cab32b1e4da75b950175c714013235dfe898497d05 customer-app/sw.js 3bfb1fd10cc13f09ca6be65c461e1f6b5750ae51a3ece12e079750b2a066052e customer-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 customer-app/brand-logo.png -e00dd397ed2207b9aa22e2e9471749f813cb979e520298dff48d39b00192bd57 display-app/index.html -ae723628a41031c2975e5d5e29ea33b672d6963a69fd92670116ed93006a98f7 display-app/sw.js +a8f3cc0762f2266942e653da738a103ba178ad91e66be065de3c7b21aaf31563 display-app/index.html +7c4f8547f3a678e4fb4f473cc026c16a45fd281978ae570ed5023acad1e3c774 display-app/sw.js 35e2721b86eb1ae1605e55bee64177adcee72f4e53a24ac417d19ea2873434a1 display-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 display-app/brand-logo.png -faf8b5ea8877404c9cbc59e022f81d5a55e32f1b3f694c26debbe13fb9129510 chef-app/index.html -20b8f2083587de66569984229a069288b3968aca283c0b3456de63ed1dbf07b5 chef-app/sw.js +e19f08f75ba1c66c5344d79b297b43fe270da2b336d885ea14f0d08d06601d9e chef-app/index.html +d80f35deb4a8829248f4c766f48959f7c2ab5bd1b59ad4e69684ef693b27e822 chef-app/sw.js 97ed43decde8a888e22b7411e13a2122c6f8b9944cf38b2e28e8f62ef2e25397 chef-app/manifest.webmanifest cc3dd9b8a359ba6c3f28d625c27cc6a01a46233311c2a5f5c8aaf09e91be8239 chef-app/brand-logo.png diff --git a/car-app/_expo/static/js/web/bundle.js b/car-app/_expo/static/js/web/bundle.js index 037046af4f6c8a62450e10d79dced419545d82a6..ded2b15d81b6b3cd18d3aa89aedffdb57caee0de 100644 --- a/car-app/_expo/static/js/web/bundle.js +++ b/car-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1633]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1634]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1629,1632]); +__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])},7,[8,10,17,692,1630,1633]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1414,1415,1416,1583,1588,1589,1628]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1415,1416,1417,1584,1589,1590,1629]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1419,8 +1419,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1336,[13,17,777,1337,1154,1263,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1412,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1365,1108,1366,1372,1374,1378,1383,1377,1384,1387,1388,1117,1095,1096,862,1393,1230,1394,1240,1232,995,1399,1404,1405,1054,1052,1119,1407,1408,1409,1071,1172,1410,1171,1162,853,1355,1411,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1445,275 +1445,276 @@ __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,"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},1362,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1363,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1364,[17,85,780,804,8]); -__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},1365,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1366,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1367,1369,1368,998,876,1108,1370,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1367,[813,843,17,1368,85,842,804,777,1109,1369,1110,8]); -__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},1368,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1369,[1368,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1370,[17,368,278,85,842,982,1371,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1371,[982,993,856,928,899]); -__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])},1372,[17,219,385,85,804,777,1172,1373,8]); -__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},1373,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1374,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1375,841,863,1096,1376,804,777,1377,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1375,[]); -__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},1376,[]); -__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)},1377,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1378,[805,813,17,266,319,219,385,85,409,804,857,1379,777,999,916,1352,1381,880,1382,1383,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1379,[17,219,85,1380,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1380,[]); -__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||'')}},1381,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1383,[17,831,928,899,1382]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1384,[843,841,998,1385,1386]); -__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])},1385,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1386,[]); -__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])},1387,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1388,[1389,843,1095,998,17,85,777,1098,858,1116,1384,1096,863,1093,1117,1118,1119,804,1344,1391,1392,1115,1361,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1389,[17,362,385,85,858,920,876,996,1390,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1390,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1393,[1172,1389,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1377,858,998,845,1089,1076,1322,804,1344,1391,1392,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1394,[812,17,219,385,85,777,858,998,1395,804,1396,1398,8]); -__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))},1395,[]); -__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)}},1396,[831,858,998,1395,1397,1398]); -__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`},1397,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1398,[219,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}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1399,[843,17,1189,1172,385,85,995,998,862,863,804,777,1400,1403,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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})})]})})}},1400,[1401,854,843,17,264,378,385,278,85,858,995,998,1402,863,804,1026,777,1403,1356,899,1344,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1401,[]); -__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)}},1402,[862,863,861]); -__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')},1403,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1405,[]); -__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},1406,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1407,[843,1385]); -__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1408,[17,385,85,777,1407,804,1364,8]); -__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]},1409,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1410,[17,1172,385,85,409,777,8]); -__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()}}},1411,[17,1005,876,926,816,1006,916,1356,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1412,[805,813,857,17,219,385,85,409,899,804,777,1352,1413,8]); -__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}})()},1413,[]); -__d(function(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]})}},1414,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1365,[219]); +__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},1366,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1367,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1368,1370,1369,998,876,1108,1371,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1368,[813,843,17,1369,85,842,804,777,1109,1370,1110,8]); +__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},1369,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1370,[1369,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1371,[17,368,278,85,842,982,1372,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1372,[982,993,856,928,899]); +__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])},1373,[17,219,385,85,804,777,1172,1374,8]); +__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},1374,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1375,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1376,841,863,1096,1377,804,777,1378,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1376,[]); +__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},1377,[]); +__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)},1378,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1379,[805,813,17,266,319,219,385,85,409,804,857,1380,777,999,916,1352,1382,880,1383,1384,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1380,[17,219,85,1381,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1381,[]); +__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||'')}},1382,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1384,[17,831,928,899,1383]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1385,[843,841,998,1386,1387]); +__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])},1386,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1387,[]); +__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])},1388,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1389,[1390,843,1095,998,17,85,1365,777,1098,858,1116,1385,1096,863,1093,1117,1118,1119,804,1344,1392,1393,1115,1361,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1390,[17,362,385,85,858,920,876,996,1391,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1391,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1394,[1172,1390,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1378,858,998,845,1089,1076,1322,804,1344,1392,1393,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1395,[812,17,219,385,85,777,858,998,1396,804,1397,1399,8]); +__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))},1396,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); +__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')},1404,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1406,[]); +__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},1407,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1408,[843,1386]); +__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1409,[17,385,85,777,1408,804,1364,8]); +__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]},1410,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1411,[17,1172,385,85,409,777,8]); +__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()}}},1412,[17,1005,876,926,816,1006,916,1356,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1413,[805,813,857,17,219,385,85,409,899,804,777,1352,1414,8]); +__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}})()},1414,[]); __d(function(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]})}},1415,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1416,[13,17,1417,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1417,[17,856,1418,1559,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1418,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1419,1184,1057,884,1427,920,219,1432,1472,839,856,1474,1481,1482,1483,1190,1246,1484,1458,1485,1487,1456,1161,1230,1394,1232,1245,1489,1084,1086,1555,1556,1575,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1420,1095,1270,1421,812,822,1117,1118,1091,1122,1422,1114,1119,1407,1408,1057,1344,996,1120,1089,841,1386,1125,1424,1241,1425,1399,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1426,1232,899,1186,1404,862,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1420,[]); -__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])},1421,[806,17,85,777,899,1274,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1422,[17,385,85,1423,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1423,[]); -__d(function(_g,_r,i,a,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'}):''},1424,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1425,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1426,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1427,[1428,17,219,24,85,856,1429,920,804,1431,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1428,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1429,[17,278,85,777,857,804,1430,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1430,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1431,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1432,[843,1140,1433,17,780,1185,1074,1075,1425,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1443,1444,1149,1445,1162,853,1448,1188,1209,856,1207,1031,1032,1066,1098,1399,1153,1343,1466,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1433,[1053,1033,805,1420,812,1434,1435,1437,1438,1439,1203,1031,1032,1008,1014,17,385,85,777,841,1440,816,862,1055,861,804,1057,858,1187,926,927,876,1441,1394,998,1442,1005,1142,892,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1434,[812,17,85,777,1140,861,804,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1435,[843,17,219,85,777,858,998,1154,1263,899,1338,1436,8]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1436,[843,1285]); -__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])},1437,[17,85,777,998,1348,804,8]); -__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},1438,[17,85,777,998,863,1402,805,8]); -__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}},1439,[]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1440,[17,1033,85,804,777,1260,1263,8]); -__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)}},1441,[17,85,777,998,1368,804,8]); -__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1442,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1443,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1444,[17,385,85,777,804,1149,1443,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1445,[886,779,816,813,822,862,1039,1446,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); -__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})({})},1446,[482,1447]); -__d(function(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={}},1447,[]); -__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1448,[888,887,813,812,1039,1449,1450,1451,1452,1454,17,385,85,857,884,777,858,876,1455,998,886,878,851,804,1057,1456,1459,1463,1464,840,8]); -__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},1449,[]); -__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])},1450,[17,899]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1451,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1452,[880,812,17,219,366,85,777,1453,899,804,1188,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1453,[]); -__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}})]})}},1454,[17,385,777,899,804,1452,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1455,[]); -__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1456,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1445,1161,1457,1458,1139,1146,1145,1008,839,1142,1149,1221,8]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1457,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1458,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1459,[812,17,1018,378,85,1108,1109,1366,1399,777,995,998,863,804,1057,999,1460,1461,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1460,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1461,[17,85,777,998,1462,842,804,1038,928,8]); -__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):''},1462,[]); -__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."})]})})}},1463,[805,1420,17,85,777,858,876,8]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1464,[17,264,385,85,777,804,915,1465,8]); -__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1465,[928,899,876,856,915]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1466,[1467,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1468,1470,899,804,1057,1180,1471,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1467,[822]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1468,[839,1469]); -__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1469,[839]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1470,[908,906,1468]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1471,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1472,[17,264,85,777,899,863,804,856,1057,1473,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1473,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1474,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1475,804,856,1057,1476,1479,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1475,[1034]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1476,[812,17,362,385,278,85,777,1477,1478,804,1474,1057,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1477,[]); -__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)}))},1478,[824,831,834]); -__d(function(g,r,_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})]})}},1479,[17,385,85,777,860,1478,998,842,1480,1475,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1480,[]); -__d(function(g,_r,i,a,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}},1481,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1482,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1445,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1483,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1484,[831]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1485,[805,1420,843,1394,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1426,848,900,1486,8]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1486,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1487,[822,1050,856,1488,876,920,909,816,866,1490,1497,1499,1458,1500,1501,1503,1504,1161,1483,1505,1506,1507,1466,1202,1193,1485,1508,1456,1509,1510,17,1199,1182,1457,1445,1459,1515,1214,1521,1522,1472,1523,1448,1433,1524,1463,1525,886,1526,1527,1529,1188,1474,1530,1394,1476,1542,1081,1057,1203,1153,1546,1549,1552,1554]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1488,[17,378,219,385,85,19,777,1026,1340,876,804,1489,1190,1484,1057,8,260]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1489,[831]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1490,[812,1454,17,851,85,777,876,804,1057,884,885,1491,899,916,1031,1452,1492,1493,1495,996,1496,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1491,[]); -__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])},1492,[812,17,85,777,804,876,1356,1355,8]); -__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])},1493,[17,85,777,1494,804,8]); -__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},1494,[831,928,899,880]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1495,[17,85,777,804,914,1022,899,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1496,[928,899]); -__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1497,[17,85,777,835,876,1498,804,1057,8]); -__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'}},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.InfoHours=function(){const{r:e}=(0,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1499,[805,1033,891,1420,813,812,822,1263,1440,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1445,1221,8]); -__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])},1500,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); -__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])},1501,[1039,17,85,1502,814,857,777,876,804,1057,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1502,[812,17,219,385,85,780,814,804,777,8]); -__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])},1503,[17,1155,847,1057,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1504,[17,1032,1057,899,915,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1505,[17,1400,1057,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1506,[17,1467,85,780,777,858,1008,1469,804,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1507,[17,85,1349,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1508,[17,776,1057,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1509,[1467,17,85,777,858,1008,876,1055,1468,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1510,[805,1420,812,822,843,1511,1439,1489,1228,841,1263,899,1512,1514,1440,17,1098,1497,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1458,853,1026,1155,847,845,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1511,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1512,[899,17,264,219,85,1281,777,1260,1263,804,1513,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1513,[17,219,85,777,1260,8]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1514,[805,1420,17,85,777,851,1260,1261,1262,899,1263,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1515,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1516,1520,804,1057,1071,8]); -__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]}})})},1516,[1517,1519,1518]); -__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)}},1517,[843,1518]); -__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'}},1518,[]); -__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:'Assistant (server, with on-device fallback)',interpret:s}},1519,[1517,1218]); -__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},1520,[869,824,831,834]); -__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1521,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); -__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1522,[17,85,777,899,863,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1523,[813,812,822,17,219,385,85,777,1230,858,1520,1214,848,1232,1018,804,1027,1057,8]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1524,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1525,[17,385,85,777,876,1000,851,1001,804,840,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1526,[17,219,385,85,409,777,804,1378,857,1382,863,899,1383,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1527,[820,896,1456,17,219,85,777,816,876,895,1000,897,899,1528,804,880,1163,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1528,[]); -__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])},1529,[17,85,777,804,1435,1511,1057,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1530,[812,1033,779,17,385,85,777,876,1481,1531,1532,1533,804,1057,8]); -__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1531,[]); -__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}},1532,[]); -__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}},1533,[1534,1100,843,1535,1536,876,858,998,1481,1531,1532,1538,1537,1540,1541,996,997]); -__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))}}]},1534,[1064,1063,1023]); -__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1535,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); -__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1536,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1537,1535]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1537,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1538,1539]); -__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1538,[824,831,834]); -__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)}))},1539,[824,831,834]); -__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1540,[816,876,910,851,1537,1017,1071]); -__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))'},1541,[]); -__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1542,[17,362,85,777,804,1477,1538,1489,1539,1543,1217,1544,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1543,[824,831,834]); -__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])},1544,[17,85,777,804,1545,8]); -__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.'},1545,[824,831,834]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1546,[17,779,85,777,845,1260,1547,1548,804,8]); -__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'},1547,[845]); -__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()})},1548,[899,1547,1263]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1549,[17,85,777,858,1008,1550,891,839,1551,1020,804,1057,8]); -__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}))},1550,[824,831,834]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1551,[839,1009,1469]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1552,[812,17,319,85,777,804,1082,978,1553,1057,8]); -__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1554,[17,264,219,85,777,812,804,899,1430,1188,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1555,[219]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1557,[]); -__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1558,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1394,1087,1481,1086,1084,1232,1245,891,876,1032,1489,880,899,804,1340,1559,1057,1419,1161,1483,1485,1474,1458,1487,1555,1557,1565,1566,1567,1570,1573,8]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1559,[17,266,347,219,385,278,85,409,780,779,1340,1458,1487,1419,1161,1485,1483,1057,1026,777,858,876,863,899,880,804,1560,1561,1562,1563,1564,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1560,[]); -__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])},1561,[17,780,8]); -__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])},1562,[17,85,777,804,8]); -__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1563,[17,385,1163,1164,816,805,777,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1564,[17,219]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1565,[1560]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1566,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1567,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1419,1057,1458,1568,1557,1566,1569,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1568,[17,385,278,85,777,804,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1569,[17,85,780,777,804,1568,1566,8]); -__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1570,[17,264,385,85,780,777,858,876,1571,915,1215,1465,804,1561,1057,1568,1572,1566,1569,1567,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1571,[831,834,824]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1572,[915]); -__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1573,[17,85,777,804,1574,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1574,[]); -__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1575,[813,812,17,385,278,85,19,1363,857,1366,1230,1394,777,998,876,891,1032,1481,1087,1086,1084,1489,1232,880,804,1419,1161,1057,1432,1483,1474,1485,1458,1487,1576,1555,1578,1580,1582,1579,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1576,[17,278,85,1502,857,777,876,814,1459,804,1577,1578,1579,8]); -__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)})},1577,[]); -__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},1578,[17]); -__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})},1579,[17,85,777,804,8]); -__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."})]})]})}},1580,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1577,1578,1579,1581,8]); -__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])},1581,[876]); -__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1582,[17,85,777,876,1060,804,1577,1578,1579,1051,1581,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1583,[13,17,856,1584,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1584,[1459,1585,813,912,1072,1511,1209,1210,1028,1025,1026,1512,1546,1514,1153,891,978,1586,975,880,1031,1032,1495,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1505,1500,1527,1587,1427,920,219,1246,1182,1188,1457,1202,1199,1482,1185,878,1212,1213,884,776,899,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1585,[17,85,777,1057,899,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1586,[219,976]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1587,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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]})}},1588,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1589,[1452,899,778,1413,1590,995,13,1617,479,17,368,319,219,24,85,805,857,1065,856,1619,19,858,998,876,804,1427,920,988,1620,1621,1028,1104,880,1008,914,1623,1383,8,1624,1625,1626,1627]); -__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])},1590,[1591,1614,1616]); -__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)}}},1591,[198,1592,1595,1609,1610,1611,1612,1613]); -__d(function(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}},1592,[198,1593]); -__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}},1593,[1594]); -__d(function(g,r,i,a,m,e,d){},1594,[]); -__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)}},1595,[1596,198,1592,1609,1610]); -__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]}})})},1596,[1597,1598,1608]); -__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()}})}},1597,[1598,1602,1607]); -__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}}},1598,[198,355,1599,1603,1604,1605,1606,1602,1607]); -__d(function(g,r,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}},1599,[198,1600,322,263,1601,1602]); -__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])},1600,[487]); -__d(function(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}}},1601,[198,322]); -__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},1602,[]); -__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}},1603,[]); -__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}},1604,[]); -__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])},1605,[1603]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1606,[]); -__d(function(g,r,i,a,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},1607,[355,1601]); -__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])},1608,[17,1598]); -__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}},1609,[1596,198]); -__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])},1610,[1596,1609]); -__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}},1611,[1592]); -__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])},1612,[198,1592,1595,1593]); -__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})({})},1613,[]); -__d(function(g,r,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]))},1614,[198,37,1615]); -__d(function(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')},1615,[198]); -__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]}},1616,[17,1591]); -__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]}})})},1617,[1618]); -__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(){}},1618,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1619,[17,24,85,409,777,857,920,899,880,805,804,1560,1562,8]); -__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()})},1620,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1621,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1622,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1622,[17,1460,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1623,[]); -__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"},1624,[]); -__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"},1625,[]); -__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"},1626,[]); -__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"},1627,[]); -__d(function(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]})}},1628,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1629,[1630]); -__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},1630,[8,1631,574]); -__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}))}}},1631,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1632,[]); -__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})}}},1633,[8,482,17,253,634]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1429,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1437,[843,1285]); +__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])},1438,[17,85,777,998,1348,804,8]); +__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},1439,[17,85,777,998,863,1403,805,8]); +__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}},1440,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1441,[17,1033,85,804,777,1260,1263,8]); +__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)}},1442,[17,85,777,998,1369,804,8]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1443,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1444,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1445,[17,385,85,777,804,1149,1444,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1446,[886,779,816,813,822,862,1039,1447,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); +__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})({})},1447,[482,1448]); +__d(function(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={}},1448,[]); +__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1449,[888,887,813,812,1039,1450,1451,1452,1453,1455,17,385,85,857,884,777,858,876,1456,998,886,878,851,804,1057,1457,1460,1464,1465,840,8]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); +__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1457,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1446,1161,1458,1459,1139,1146,1145,1008,839,1142,1149,1221,8]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1458,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1459,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1460,[812,17,1018,378,85,1108,1109,1367,1400,777,995,998,863,804,1057,999,1461,1462,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1461,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1462,[17,85,777,998,1463,842,804,1038,928,8]); +__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):''},1463,[]); +__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."})]})})}},1464,[805,1421,17,85,777,858,876,8]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1465,[17,264,385,85,777,804,915,1466,8]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1466,[928,899,876,856,915]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1467,[1468,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1469,1471,899,804,1057,1180,1472,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1468,[822]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1469,[839,1470]); +__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1470,[839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1471,[908,906,1469]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); +__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)}))},1479,[824,831,834]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); +__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])},1493,[812,17,85,777,804,876,1356,1355,8]); +__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])},1494,[17,85,777,1495,804,8]); +__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},1495,[831,928,899,880]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1496,[17,85,777,804,914,1022,899,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1497,[928,899]); +__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1498,[17,85,777,835,876,1499,804,1057,8]); +__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'}},1499,[]); +__d(function(_g,_r,_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,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1500,[805,1033,891,1421,813,812,822,1263,1441,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1446,1221,8]); +__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])},1501,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); +__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])},1502,[1039,17,85,1503,814,857,777,876,804,1057,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1503,[812,17,219,385,85,780,814,804,777,8]); +__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])},1504,[17,1155,847,1057,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1505,[17,1032,1057,899,915,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1506,[17,1401,1057,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1507,[17,1468,85,780,777,858,1008,1470,804,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1515,[805,1421,17,85,777,851,1260,1261,1262,899,1263,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1516,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1517,1521,804,1057,1071,8]); +__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]}})})},1517,[1518,1520,1519]); +__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)}},1518,[843,1519]); +__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'}},1519,[]); +__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:'Assistant (server, with on-device fallback)',interpret:s}},1520,[1518,1218]); +__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},1521,[869,824,831,834]); +__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1522,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); +__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1523,[17,85,777,899,863,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1524,[813,812,822,17,219,385,85,777,1230,858,1521,1214,848,1232,1018,804,1027,1057,8]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1525,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1526,[17,385,85,777,876,1000,851,1001,804,840,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1527,[17,219,385,85,409,777,804,1379,857,1383,863,899,1384,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1528,[820,896,1457,17,219,85,777,816,876,895,1000,897,899,1529,804,880,1163,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1529,[]); +__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])},1530,[17,85,777,804,1436,1512,1057,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1531,[812,1033,779,17,385,85,777,876,1482,1532,1533,1534,804,1057,8]); +__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1532,[]); +__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}},1533,[]); +__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}},1534,[1535,1100,843,1536,1537,876,858,998,1482,1532,1533,1539,1538,1541,1542,996,997]); +__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))}}]},1535,[1064,1063,1023]); +__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1536,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); +__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1537,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1538,1536]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1538,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1539,1540]); +__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1539,[824,831,834]); +__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)}))},1540,[824,831,834]); +__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1541,[816,876,910,851,1538,1017,1071]); +__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))'},1542,[]); +__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1543,[17,362,85,777,804,1478,1539,1490,1540,1544,1217,1545,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1544,[824,831,834]); +__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])},1545,[17,85,777,804,1546,8]); +__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.'},1546,[824,831,834]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1547,[17,779,85,777,845,1260,1548,1549,804,8]); +__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'},1548,[845]); +__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()})},1549,[899,1548,1263]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1550,[17,85,777,858,1008,1551,891,839,1552,1020,804,1057,8]); +__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}))},1551,[824,831,834]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1559,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1395,1087,1482,1086,1084,1232,1245,891,876,1032,1490,880,899,804,1340,1560,1057,1420,1161,1484,1486,1475,1459,1488,1556,1558,1566,1567,1568,1571,1574,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1560,[17,266,347,219,385,278,85,409,780,779,1340,1459,1488,1420,1161,1486,1484,1057,1026,777,858,876,863,899,880,804,1561,1562,1563,1564,1565,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1561,[]); +__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])},1562,[17,780,8]); +__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])},1563,[17,85,777,804,8]); +__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1564,[17,385,1163,1164,816,805,777,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1565,[17,219]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1566,[1561]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1567,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1568,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1420,1057,1459,1569,1558,1567,1570,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1569,[17,385,278,85,777,804,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1570,[17,85,780,777,804,1569,1567,8]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1571,[17,264,385,85,780,777,858,876,1572,915,1215,1466,804,1562,1057,1569,1573,1567,1570,1568,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1572,[831,834,824]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1573,[915]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1574,[17,85,777,804,1575,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1575,[]); +__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1576,[813,812,17,385,278,85,19,1363,857,1367,1230,1395,777,998,876,891,1032,1482,1087,1086,1084,1490,1232,880,804,1420,1161,1057,1433,1484,1475,1486,1459,1488,1577,1556,1579,1581,1583,1580,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1577,[17,278,85,1503,857,777,876,814,1460,804,1578,1579,1580,8]); +__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)})},1578,[]); +__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},1579,[17]); +__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})},1580,[17,85,777,804,8]); +__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."})]})]})}},1581,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1578,1579,1580,1582,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(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]})}},1589,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1590,[1453,899,778,1414,1591,995,13,1618,479,17,368,319,219,24,85,805,857,1065,856,1620,19,858,998,876,804,1428,920,988,1621,1622,1028,1104,880,1008,914,1624,1384,8,1625,1626,1627,1628]); +__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])},1591,[1592,1615,1617]); +__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)}}},1592,[198,1593,1596,1610,1611,1612,1613,1614]); +__d(function(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}},1593,[198,1594]); +__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}},1594,[1595]); +__d(function(g,r,i,a,m,e,d){},1595,[]); +__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)}},1596,[1597,198,1593,1610,1611]); +__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]}})})},1597,[1598,1599,1609]); +__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()}})}},1598,[1599,1603,1608]); +__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}}},1599,[198,355,1600,1604,1605,1606,1607,1603,1608]); +__d(function(g,r,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}},1600,[198,1601,322,263,1602,1603]); +__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])},1601,[487]); +__d(function(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}}},1602,[198,322]); +__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},1603,[]); +__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}},1604,[]); +__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}},1605,[]); +__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])},1606,[1604]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1607,[]); +__d(function(g,r,i,a,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},1608,[355,1602]); +__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])},1609,[17,1599]); +__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}},1610,[1597,198]); +__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])},1611,[1597,1610]); +__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}},1612,[1593]); +__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])},1613,[198,1593,1596,1594]); +__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})({})},1614,[]); +__d(function(g,r,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]))},1615,[198,37,1616]); +__d(function(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')},1616,[198]); +__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]}},1617,[17,1592]); +__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]}})})},1618,[1619]); +__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(){}},1619,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1620,[17,24,85,409,777,857,920,899,880,805,804,1561,1563,8]); +__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()})},1621,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1622,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1623,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1623,[17,1461,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1624,[]); +__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"},1625,[]); +__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"},1626,[]); +__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"},1627,[]); +__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"},1628,[]); +__d(function(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]})}},1629,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1630,[1631]); +__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},1631,[8,1632,574]); +__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}))}}},1632,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1633,[]); +__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})}}},1634,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/car-app/index.html b/car-app/index.html index 97c243c79980d0c057bc78c4ab01cc355cb43baf..b06159410df521aab82e3ef94dd64ca033aca729 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 e9889812f2d02650c42e958bbedc1294f90c3d0e..db8aa030da1f7257022d32f4dc3b2d7a75d82121 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 19b4ddbcdc39d8dbbe0b7fb721ad76ef6b709e3b..d14383227ee60cad2768b809c81ae9d56be0e3c9 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-070270ac01"; +const V = "cc-car-331ba98185"; const BASE = "/car-app/"; -const PRECACHE = ["/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=070270ac0197687ddb3688d73ab945071878b6462dd4faa732496e326e4732e6"]; +const PRECACHE = ["/car-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/car-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/car-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/car-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/car-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/car-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/car-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/car-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/car-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/car-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/car-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/car-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/car-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/car-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/car-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/car-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/car-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/car-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/car-app/favicon.ico", "/car-app/index.html", "/car-app/_expo/static/js/web/bundle.js?v=331ba981856105282282edaea8b266b1eb4130ceb0d045e71bbc065965b50cdf"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/chef-app/_expo/static/js/web/bundle.js b/chef-app/_expo/static/js/web/bundle.js index 018e1bf348da75de214762ba9018ce55aa32ce8c..1ecf51297aef100db075b72355f1e2bc6283116a 100644 --- a/chef-app/_expo/static/js/web/bundle.js +++ b/chef-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1508]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1509]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1504,1507]); +__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])},7,[8,10,17,692,1505,1508]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1414,1415,1416,1418,1459,1460,1503]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1415,1416,1417,1419,1460,1461,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 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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1419,8 +1419,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1336,[13,17,777,1337,1154,1263,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1412,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1365,1108,1366,1372,1374,1378,1383,1377,1384,1387,1388,1117,1095,1096,862,1393,1230,1394,1240,1232,995,1399,1404,1405,1054,1052,1119,1407,1408,1409,1071,1172,1410,1171,1162,853,1355,1411,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1445,150 +1445,151 @@ __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,"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},1362,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1363,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1364,[17,85,780,804,8]); -__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},1365,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1366,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1367,1369,1368,998,876,1108,1370,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1367,[813,843,17,1368,85,842,804,777,1109,1369,1110,8]); -__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},1368,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1369,[1368,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1370,[17,368,278,85,842,982,1371,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1371,[982,993,856,928,899]); -__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])},1372,[17,219,385,85,804,777,1172,1373,8]); -__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},1373,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1374,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1375,841,863,1096,1376,804,777,1377,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1375,[]); -__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},1376,[]); -__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)},1377,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1378,[805,813,17,266,319,219,385,85,409,804,857,1379,777,999,916,1352,1381,880,1382,1383,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1379,[17,219,85,1380,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1380,[]); -__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||'')}},1381,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1383,[17,831,928,899,1382]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1384,[843,841,998,1385,1386]); -__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])},1385,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1386,[]); -__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])},1387,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1388,[1389,843,1095,998,17,85,777,1098,858,1116,1384,1096,863,1093,1117,1118,1119,804,1344,1391,1392,1115,1361,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1389,[17,362,385,85,858,920,876,996,1390,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1390,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1393,[1172,1389,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1377,858,998,845,1089,1076,1322,804,1344,1391,1392,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1394,[812,17,219,385,85,777,858,998,1395,804,1396,1398,8]); -__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))},1395,[]); -__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)}},1396,[831,858,998,1395,1397,1398]); -__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`},1397,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1398,[219,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}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1399,[843,17,1189,1172,385,85,995,998,862,863,804,777,1400,1403,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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})})]})})}},1400,[1401,854,843,17,264,378,385,278,85,858,995,998,1402,863,804,1026,777,1403,1356,899,1344,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1401,[]); -__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)}},1402,[862,863,861]); -__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')},1403,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1405,[]); -__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},1406,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1407,[843,1385]); -__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1408,[17,385,85,777,1407,804,1364,8]); -__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]},1409,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1410,[17,1172,385,85,409,777,8]); -__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()}}},1411,[17,1005,876,926,816,1006,916,1356,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1412,[805,813,857,17,219,385,85,409,899,804,777,1352,1413,8]); -__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}})()},1413,[]); -__d(function(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]})}},1414,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1365,[219]); +__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},1366,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1367,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1368,1370,1369,998,876,1108,1371,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1368,[813,843,17,1369,85,842,804,777,1109,1370,1110,8]); +__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},1369,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1370,[1369,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1371,[17,368,278,85,842,982,1372,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1372,[982,993,856,928,899]); +__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])},1373,[17,219,385,85,804,777,1172,1374,8]); +__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},1374,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1375,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1376,841,863,1096,1377,804,777,1378,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1376,[]); +__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},1377,[]); +__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)},1378,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1379,[805,813,17,266,319,219,385,85,409,804,857,1380,777,999,916,1352,1382,880,1383,1384,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1380,[17,219,85,1381,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1381,[]); +__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||'')}},1382,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1384,[17,831,928,899,1383]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1385,[843,841,998,1386,1387]); +__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])},1386,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1387,[]); +__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])},1388,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1389,[1390,843,1095,998,17,85,1365,777,1098,858,1116,1385,1096,863,1093,1117,1118,1119,804,1344,1392,1393,1115,1361,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1390,[17,362,385,85,858,920,876,996,1391,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1391,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1394,[1172,1390,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1378,858,998,845,1089,1076,1322,804,1344,1392,1393,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1395,[812,17,219,385,85,777,858,998,1396,804,1397,1399,8]); +__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))},1396,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); +__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')},1404,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1406,[]); +__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},1407,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1408,[843,1386]); +__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1409,[17,385,85,777,1408,804,1364,8]); +__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]},1410,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1411,[17,1172,385,85,409,777,8]); +__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()}}},1412,[17,1005,876,926,816,1006,916,1356,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1413,[805,813,857,17,219,385,85,409,899,804,777,1352,1414,8]); +__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}})()},1414,[]); __d(function(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]})}},1415,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1416,[13,17,1417,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1417,[]); -__d(function(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]})}},1418,[13,17,856,1419,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1419,[1420,1424,813,912,1072,1425,1209,1210,1028,1025,1026,1426,1428,1431,1153,891,978,1433,975,880,1031,1032,1434,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1435,1066,1084,1086,1081,1027,1010,1057,1442,1443,1444,1452,1453,920,219,1246,1182,1188,1449,1202,1199,1458,1185,878,1212,1213,884,776,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1420,[812,17,1018,378,85,1108,1109,1366,1399,777,995,998,863,804,1057,999,1421,1422,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1421,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1422,[17,85,777,998,1423,842,804,1038,928,8]); -__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):''},1423,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1424,[17,85,777,1057,899,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1425,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1426,[899,17,264,219,85,1281,777,1260,1263,804,1427,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1427,[17,219,85,777,1260,8]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1428,[17,779,85,777,845,1260,1429,1430,804,8]); -__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'},1429,[845]); -__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()})},1430,[899,1429,1263]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1431,[805,1432,17,85,777,851,1260,1261,1262,899,1263,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1432,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1433,[219,976]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1434,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1435,[805,1432,1095,1270,1436,812,822,1117,1118,1091,1122,1437,1114,1119,1407,1408,1057,1344,996,1120,1089,841,1386,1125,1439,1241,1440,1399,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1441,1232,899,1186,1404,862,8]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1436,[806,17,85,777,899,1274,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1437,[17,385,85,1438,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1438,[]); -__d(function(_g,_r,i,a,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'}):''},1439,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1440,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1441,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1442,[17,1400,1057,8]); -__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])},1443,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1444,[820,896,1445,17,219,85,777,816,876,895,1000,897,899,1451,804,880,1163,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1445,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1446,1161,1449,1450,1139,1146,1145,1008,839,1142,1149,1221,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1446,[886,779,816,813,822,862,1039,1447,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); -__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})({})},1447,[482,1448]); -__d(function(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={}},1448,[]); -__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1449,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1450,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1451,[]); -__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)','')},1452,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1453,[1454,17,219,24,85,856,1455,920,804,1457,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1454,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1455,[17,278,85,777,857,804,1456,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1456,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1457,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1458,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); -__d(function(g,r,i,a,m,e,d){"use strict";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]})}},1459,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1460,[1461,899,778,1413,1463,995,13,1490,479,17,368,319,219,24,85,805,857,1065,856,1492,19,858,998,876,804,1453,920,988,1495,1496,1028,1104,880,1008,914,1498,1383,8,1499,1500,1501,1502]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1461,[880,812,17,219,366,85,777,1462,899,804,1188,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1462,[]); -__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])},1463,[1464,1487,1489]); -__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)}}},1464,[198,1465,1468,1482,1483,1484,1485,1486]); -__d(function(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}},1465,[198,1466]); -__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}},1466,[1467]); -__d(function(g,r,i,a,m,e,d){},1467,[]); -__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)}},1468,[1469,198,1465,1482,1483]); -__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]}})})},1469,[1470,1471,1481]); -__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()}})}},1470,[1471,1475,1480]); -__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}}},1471,[198,355,1472,1476,1477,1478,1479,1475,1480]); -__d(function(g,r,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}},1472,[198,1473,322,263,1474,1475]); -__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])},1473,[487]); -__d(function(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}}},1474,[198,322]); -__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},1475,[]); -__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}},1476,[]); -__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}},1477,[]); -__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])},1478,[1476]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1479,[]); -__d(function(g,r,i,a,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},1480,[355,1474]); -__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])},1481,[17,1471]); -__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}},1482,[1469,198]); -__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])},1483,[1469,1482]); -__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}},1484,[1465]); -__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])},1485,[198,1465,1468,1466]); -__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})({})},1486,[]); -__d(function(g,r,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]))},1487,[198,37,1488]); -__d(function(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')},1488,[198]); -__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]}},1489,[17,1464]); -__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]}})})},1490,[1491]); -__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(){}},1491,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1492,[17,24,85,409,777,857,920,899,880,805,804,1493,1494,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1493,[]); -__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])},1494,[17,85,777,804,8]); -__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()})},1495,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1496,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1497,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1497,[17,1421,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1498,[]); -__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"},1499,[]); -__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"},1500,[]); -__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"},1501,[]); -__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"},1502,[]); -__d(function(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]})}},1503,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1504,[1505]); -__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},1505,[8,1506,574]); -__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}))}}},1506,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1507,[]); -__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})}}},1508,[8,482,17,253,634]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1418,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1419,[13,17,856,1420,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1420,[1421,1425,813,912,1072,1426,1209,1210,1028,1025,1026,1427,1429,1432,1153,891,978,1434,975,880,1031,1032,1435,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1436,1066,1084,1086,1081,1027,1010,1057,1443,1444,1445,1453,1454,920,219,1246,1182,1188,1450,1202,1199,1459,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1421,[812,17,1018,378,85,1108,1109,1367,1400,777,995,998,863,804,1057,999,1422,1423,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1422,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1423,[17,85,777,998,1424,842,804,1038,928,8]); +__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):''},1424,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1425,[17,85,777,1057,899,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1426,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1427,[899,17,264,219,85,1281,777,1260,1263,804,1428,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1428,[17,219,85,777,1260,8]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1429,[17,779,85,777,845,1260,1430,1431,804,8]); +__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'},1430,[845]); +__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()})},1431,[899,1430,1263]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1432,[805,1433,17,85,777,851,1260,1261,1262,899,1263,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1433,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1434,[219,976]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1435,[17,85,777,804,914,1022,899,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1436,[805,1433,1095,1270,1437,812,822,1117,1118,1091,1122,1438,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1440,1241,1441,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1442,1232,899,1186,1405,862,8]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1437,[806,17,85,777,899,1274,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1438,[17,385,85,1439,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1439,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1440,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1441,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1442,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1443,[17,1401,1057,8]); +__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])},1444,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1445,[820,896,1446,17,219,85,777,816,876,895,1000,897,899,1452,804,880,1163,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1446,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1447,1161,1450,1451,1139,1146,1145,1008,839,1142,1149,1221,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1447,[886,779,816,813,822,862,1039,1448,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); +__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})({})},1448,[482,1449]); +__d(function(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={}},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.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,{money:!0,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,{money:!0,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})})]})}},1450,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1451,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1452,[]); +__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)','')},1453,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1454,[1455,17,219,24,85,856,1456,920,804,1458,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1455,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1456,[17,278,85,777,857,804,1457,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1457,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1458,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1459,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1447,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1460,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1461,[1462,899,778,1414,1464,995,13,1491,479,17,368,319,219,24,85,805,857,1065,856,1493,19,858,998,876,804,1454,920,988,1496,1497,1028,1104,880,1008,914,1499,1384,8,1500,1501,1502,1503]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1462,[880,812,17,219,366,85,777,1463,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1463,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1464,[1465,1488,1490]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1465,[198,1466,1469,1483,1484,1485,1486,1487]); +__d(function(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}},1466,[198,1467]); +__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}},1467,[1468]); +__d(function(g,r,i,a,m,e,d){},1468,[]); +__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)}},1469,[1470,198,1466,1483,1484]); +__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]}})})},1470,[1471,1472,1482]); +__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()}})}},1471,[1472,1476,1481]); +__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}}},1472,[198,355,1473,1477,1478,1479,1480,1476,1481]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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}},1473,[198,1474,322,263,1475,1476]); +__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])},1474,[487]); +__d(function(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}}},1475,[198,322]); +__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},1476,[]); +__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}},1477,[]); +__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}},1478,[]); +__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])},1479,[1477]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1480,[]); +__d(function(g,r,i,a,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},1481,[355,1475]); +__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])},1482,[17,1472]); +__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}},1483,[1470,198]); +__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])},1484,[1470,1483]); +__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}},1485,[1466]); +__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])},1486,[198,1466,1469,1467]); +__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})({})},1487,[]); +__d(function(g,r,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]))},1488,[198,37,1489]); +__d(function(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')},1489,[198]); +__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]}},1490,[17,1465]); +__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]}})})},1491,[1492]); +__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(){}},1492,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1493,[17,24,85,409,777,857,920,899,880,805,804,1494,1495,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1494,[]); +__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])},1495,[17,85,777,804,8]); +__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()})},1496,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1497,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1498,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1498,[17,1422,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1499,[]); +__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"},1500,[]); +__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"},1501,[]); +__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"},1502,[]); +__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"},1503,[]); +__d(function(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]})}},1504,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1505,[1506]); +__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},1506,[8,1507,574]); +__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}))}}},1507,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1508,[]); +__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})}}},1509,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/chef-app/admin.html b/chef-app/admin.html index 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 198e5cd7f4afffe0415b9369aa9730fff3e81571..302c57bf92bc1a57a433a98c7adbab4b3214216a 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 17c64818c831a2f45dae660a30cd6373c08d66bf..bd1b00f7223bc3dfab744a34f4dd7c71645a858c 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-48a99b45a5"; +const V = "cc-chef-0740d866b1"; const BASE = "/chef-app/"; -const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=48a99b45a5beb49e77f1f778989d6675b8e22f0713c517e7cc0a8f950db85e91"]; +const PRECACHE = ["/chef-app/apple-touch-icon.png", "/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/chef-app/brand-logo.png", "/chef-app/favicon.ico", "/chef-app/icon-192.png", "/chef-app/icon-512.png", "/chef-app/icon-maskable-192.png", "/chef-app/icon-maskable-512.png", "/chef-app/manifest.webmanifest", "/chef-app/index.html", "/chef-app/_expo/static/js/web/bundle.js?v=0740d866b15dea317e08ff18834c25e168985fde9d0c2d44517490482ad6411b"]; // 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 2921085162254f1a73e4ef004cc86f884aa747f5..126f61dc5b896801c00d002b3d1eb9391604af17 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 3c4c52cb49e6d5e71442c4e04edb2c73997ab48e..9a3caef9ae82ace46f5d19b77f1fdcb05d8c2641 100644 --- a/customer-app/_expo/static/js/web/bundle.js +++ b/customer-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1492]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1493]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1488,1491]); +__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])},7,[8,10,17,692,1489,1492]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1226,1227,1232,1236,1238,1245,1299,1300,1301,1302,1303,1304,1306,1307,1308,1309,1313,1316,1317,1318,1319,1322,1397,1398,1399,1401,1443,1444,1487]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1226,1227,1232,1236,1238,1245,1299,1300,1301,1302,1303,1304,1306,1307,1308,1309,1313,1316,1317,1318,1319,1322,1398,1399,1400,1402,1444,1445,1488]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1402,8 +1402,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1319,[13,17,777,1320,1154,1244,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1320,[812,843,17,85,777,845,851,1154,1321,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1321,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1395,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1348,1108,1349,1355,1357,1361,1366,1360,1367,1370,1371,1117,1095,1096,862,1376,1209,1377,1219,1211,995,1382,1387,1388,1054,1052,1119,1390,1391,1392,1071,1172,1393,1171,1162,853,1338,1394,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1396,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1326,[]); @@ -1428,151 +1428,152 @@ __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,"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},1345,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1346,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1347,[17,85,780,804,8]); -__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},1348,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1349,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1350,1352,1351,998,876,1108,1353,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1350,[813,843,17,1351,85,842,804,777,1109,1352,1110,8]); -__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},1351,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1352,[1351,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1353,[17,368,278,85,842,982,1354,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1354,[982,993,856,928,899]); -__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])},1355,[17,219,385,85,804,777,1172,1356,8]); -__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},1356,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1357,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1358,841,863,1096,1359,804,777,1360,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1358,[]); -__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},1359,[]); -__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)},1360,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1361,[805,813,17,266,319,219,385,85,409,804,857,1362,777,999,916,1335,1364,880,1365,1366,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1362,[17,219,85,1363,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1363,[]); -__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||'')}},1364,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1366,[17,831,928,899,1365]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1367,[843,841,998,1368,1369]); -__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])},1368,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1369,[]); -__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])},1370,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1371,[1372,843,1095,998,17,85,777,1098,858,1116,1367,1096,863,1093,1117,1118,1119,804,1327,1374,1375,1115,1344,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1372,[17,362,385,85,858,920,876,996,1373,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1373,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1376,[1172,1372,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1360,858,998,845,1089,1076,1305,804,1327,1374,1375,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1377,[812,17,219,385,85,777,858,998,1378,804,1379,1381,8]); -__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))},1378,[]); -__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)}},1379,[831,858,998,1378,1380,1381]); -__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`},1380,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1381,[219,1380]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1382,[843,17,1183,1172,385,85,995,998,862,863,804,777,1383,1386,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1383,[1384,854,843,17,264,378,385,278,85,858,995,998,1385,863,804,1026,777,1386,1339,899,1327,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1384,[]); -__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)}},1385,[862,863,861]); -__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')},1386,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1388,[]); -__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},1389,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1390,[843,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.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1391,[17,385,85,777,1390,804,1347,8]); -__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]},1392,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1393,[17,1172,385,85,409,777,8]); -__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()}}},1394,[17,1005,876,926,816,1006,916,1339,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1395,[805,813,857,17,219,385,85,409,899,804,777,1335,1396,8]); -__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}})()},1396,[]); -__d(function(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]})}},1397,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1348,[219]); +__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},1349,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1350,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1351,1353,1352,998,876,1108,1354,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1351,[813,843,17,1352,85,842,804,777,1109,1353,1110,8]); +__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},1352,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1353,[1352,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1354,[17,368,278,85,842,982,1355,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1355,[982,993,856,928,899]); +__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])},1356,[17,219,385,85,804,777,1172,1357,8]); +__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},1357,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1358,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1359,841,863,1096,1360,804,777,1361,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1359,[]); +__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},1360,[]); +__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)},1361,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1362,[805,813,17,266,319,219,385,85,409,804,857,1363,777,999,916,1335,1365,880,1366,1367,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1363,[17,219,85,1364,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1364,[]); +__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||'')}},1365,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1367,[17,831,928,899,1366]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1368,[843,841,998,1369,1370]); +__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])},1369,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1370,[]); +__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])},1371,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1372,[1373,843,1095,998,17,85,1348,777,1098,858,1116,1368,1096,863,1093,1117,1118,1119,804,1327,1375,1376,1115,1344,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1373,[17,362,385,85,858,920,876,996,1374,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1374,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1377,[1172,1373,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1361,858,998,845,1089,1076,1305,804,1327,1375,1376,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1378,[812,17,219,385,85,777,858,998,1379,804,1380,1382,8]); +__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))},1379,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1380,[831,858,998,1379,1381,1382]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1381,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1382,[219,1381]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1183,1172,385,85,995,998,862,863,804,777,1384,1387,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1384,[1385,854,843,17,264,378,385,278,85,858,995,998,1386,863,804,1026,777,1387,1339,899,1327,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1385,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1386,[862,863,861]); +__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')},1387,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1389,[]); +__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},1390,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1391,[843,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.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1392,[17,385,85,777,1391,804,1347,8]); +__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]},1393,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1394,[17,1172,385,85,409,777,8]); +__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()}}},1395,[17,1005,876,926,816,1006,916,1339,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1396,[805,813,857,17,219,385,85,409,899,804,777,1335,1397,8]); +__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}})()},1397,[]); __d(function(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]})}},1398,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1399,[13,17,1400,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1400,[]); -__d(function(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]})}},1401,[13,17,856,1402,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1402,[1403,1407,813,912,1072,1408,1203,1204,1028,1025,1026,1409,1411,1414,1153,891,978,1416,975,880,1031,1032,1417,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1418,1066,1084,1086,1081,1027,1010,1057,1425,1426,1427,1436,1437,920,219,1225,1176,1182,1433,1196,1193,1442,1179,878,1206,1207,884,776,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1403,[812,17,1018,378,85,1108,1109,1349,1382,777,995,998,863,804,1057,999,1404,1405,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1404,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1405,[17,85,777,998,1406,842,804,1038,928,8]); -__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):''},1406,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1407,[17,85,777,1057,899,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1408,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1409,[899,17,264,219,85,1264,777,1241,1244,804,1410,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1410,[17,219,85,777,1241,8]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1411,[17,779,85,777,845,1241,1412,1413,804,8]); -__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'},1412,[845]); -__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()})},1413,[899,1412,1244]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1414,[805,1415,17,85,777,851,1241,1242,1243,899,1244,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1415,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1416,[219,976]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1417,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1418,[805,1415,1095,1251,1419,812,822,1117,1118,1091,1122,1420,1114,1119,1390,1391,1057,1327,996,1120,1089,841,1369,1125,1422,1220,1423,1382,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1424,1211,899,1180,1387,862,8]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1419,[806,17,85,777,899,1255,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1420,[17,385,85,1421,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1421,[]); -__d(function(_g,_r,i,a,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'}):''},1422,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1423,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1424,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1425,[17,1383,1057,8]); -__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])},1426,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1427,[820,896,1428,17,219,85,777,816,876,895,1000,897,899,1435,804,880,1163,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1428,[812,891,1140,899,780,1209,1211,17,264,362,219,385,85,409,864,777,858,1220,876,851,863,804,1178,1057,853,1055,1429,1161,1433,1434,1139,1146,1145,1008,839,1142,1149,1432,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1429,[886,779,816,813,822,862,1039,1430,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1432,8]); -__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})({})},1430,[482,1431]); -__d(function(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={}},1431,[]); -__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)}},1432,[816,876,805]); -__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1433,[812,17,1234,1026,854,362,385,85,777,876,851,863,804,1178,1057,1432,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1434,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1435,[]); -__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)','')},1436,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1437,[1438,17,219,24,85,856,1439,920,804,1441,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1438,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1439,[17,278,85,777,857,804,1440,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1440,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1441,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1442,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1429,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); -__d(function(g,r,i,a,m,e,d){"use strict";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]})}},1443,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1444,[1445,899,778,1396,1447,995,13,1474,479,17,368,319,219,24,85,805,857,1065,856,1476,19,858,998,876,804,1437,920,988,1479,1480,1028,1104,880,1008,914,1482,1366,8,1483,1484,1485,1486]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1445,[880,812,17,219,366,85,777,1446,899,804,1182,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1446,[]); -__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])},1447,[1448,1471,1473]); -__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)}}},1448,[198,1449,1452,1466,1467,1468,1469,1470]); -__d(function(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}},1449,[198,1450]); -__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}},1450,[1451]); -__d(function(g,r,i,a,m,e,d){},1451,[]); -__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)}},1452,[1453,198,1449,1466,1467]); -__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]}})})},1453,[1454,1455,1465]); -__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()}})}},1454,[1455,1459,1464]); -__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}}},1455,[198,355,1456,1460,1461,1462,1463,1459,1464]); -__d(function(g,r,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}},1456,[198,1457,322,263,1458,1459]); -__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])},1457,[487]); -__d(function(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}}},1458,[198,322]); -__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},1459,[]); -__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}},1460,[]); -__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}},1461,[]); -__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])},1462,[1460]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1463,[]); -__d(function(g,r,i,a,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},1464,[355,1458]); -__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])},1465,[17,1455]); -__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}},1466,[1453,198]); -__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])},1467,[1453,1466]); -__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}},1468,[1449]); -__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])},1469,[198,1449,1452,1450]); -__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})({})},1470,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]))},1471,[198,37,1472]); -__d(function(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')},1472,[198]); -__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]}},1473,[17,1448]); -__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]}})})},1474,[1475]); -__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(){}},1475,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1476,[17,24,85,409,777,857,920,899,880,805,804,1477,1478,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1477,[]); -__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])},1478,[17,85,777,804,8]); -__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()})},1479,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1480,[813,779,17,974,385,85,856,899,976,804,777,1335,971,880,1481,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1481,[17,1404,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1482,[]); -__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"},1483,[]); -__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"},1484,[]); -__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"},1485,[]); -__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"},1486,[]); -__d(function(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]})}},1487,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1488,[1489]); -__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},1489,[8,1490,574]); -__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}))}}},1490,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1491,[]); -__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})}}},1492,[8,482,17,253,634]); +__d(function(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]})}},1399,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1400,[13,17,1401,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1401,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1402,[13,17,856,1403,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1182,1434,1196,1193,1443,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1404,[812,17,1018,378,85,1108,1109,1350,1383,777,995,998,863,804,1057,999,1405,1406,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1405,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1406,[17,85,777,998,1407,842,804,1038,928,8]); +__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):''},1407,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1408,[17,85,777,1057,899,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1409,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1410,[899,17,264,219,85,1264,777,1241,1244,804,1411,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1411,[17,219,85,777,1241,8]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1412,[17,779,85,777,845,1241,1413,1414,804,8]); +__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'},1413,[845]); +__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()})},1414,[899,1413,1244]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1415,[805,1416,17,85,777,851,1241,1242,1243,899,1244,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1416,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1417,[219,976]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1418,[17,85,777,804,914,1022,899,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1180,1388,862,8]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1420,[806,17,85,777,899,1255,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1421,[17,385,85,1422,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1422,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1424,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1425,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1426,[17,1384,1057,8]); +__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])},1427,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1428,[820,896,1429,17,219,85,777,816,876,895,1000,897,899,1436,804,880,1163,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1429,[812,891,1140,899,780,1209,1211,17,264,362,219,385,85,409,864,777,858,1220,876,851,863,804,1178,1057,853,1055,1430,1161,1434,1435,1139,1146,1145,1008,839,1142,1149,1433,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1430,[886,779,816,813,822,862,1039,1431,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1433,8]); +__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})({})},1431,[482,1432]); +__d(function(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={}},1432,[]); +__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)}},1433,[816,876,805]); +__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1434,[812,17,1234,1026,854,362,385,85,777,876,851,863,804,1178,1057,1433,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1435,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1436,[]); +__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)','')},1437,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1438,[1439,17,219,24,85,856,1440,920,804,1442,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1439,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1440,[17,278,85,777,857,804,1441,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1441,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1442,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1444,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1445,[1446,899,778,1397,1448,995,13,1475,479,17,368,319,219,24,85,805,857,1065,856,1477,19,858,998,876,804,1438,920,988,1480,1481,1028,1104,880,1008,914,1483,1367,8,1484,1485,1486,1487]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1447,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1448,[1449,1472,1474]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1449,[198,1450,1453,1467,1468,1469,1470,1471]); +__d(function(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}},1450,[198,1451]); +__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}},1451,[1452]); +__d(function(g,r,i,a,m,e,d){},1452,[]); +__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)}},1453,[1454,198,1450,1467,1468]); +__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]}})})},1454,[1455,1456,1466]); +__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()}})}},1455,[1456,1460,1465]); +__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}}},1456,[198,355,1457,1461,1462,1463,1464,1460,1465]); +__d(function(g,r,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}},1457,[198,1458,322,263,1459,1460]); +__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])},1458,[487]); +__d(function(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}}},1459,[198,322]); +__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},1460,[]); +__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}},1461,[]); +__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}},1462,[]); +__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])},1463,[1461]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1464,[]); +__d(function(g,r,i,a,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},1465,[355,1459]); +__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])},1466,[17,1456]); +__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}},1467,[1454,198]); +__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])},1468,[1454,1467]); +__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}},1469,[1450]); +__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])},1470,[198,1450,1453,1451]); +__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})({})},1471,[]); +__d(function(g,r,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]))},1472,[198,37,1473]); +__d(function(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')},1473,[198]); +__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]}},1474,[17,1449]); +__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]}})})},1475,[1476]); +__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(){}},1476,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1477,[17,24,85,409,777,857,920,899,880,805,804,1478,1479,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1478,[]); +__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])},1479,[17,85,777,804,8]); +__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()})},1480,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1481,[813,779,17,974,385,85,856,899,976,804,777,1335,971,880,1482,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1482,[17,1405,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1483,[]); +__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"},1484,[]); +__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"},1485,[]); +__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"},1486,[]); +__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"},1487,[]); +__d(function(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]})}},1488,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1489,[1490]); +__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},1490,[8,1491,574]); +__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}))}}},1491,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1492,[]); +__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})}}},1493,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/customer-app/admin.html b/customer-app/admin.html index 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 1a890883c5ff72d3054db875b8f00ef7fb9e4cf7..290420f735e0a34b0b64d1e8fae9b0a918160bde 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 73d89d4a6c9c5a96b48ad590badf7f9b1e482d4b..b094e417699117eb651e8829e8bf66e316ff3d2e 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-b6528a6bbb"; +const V = "cc-customer-978bc9cd41"; const BASE = "/customer-app/"; -const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=b6528a6bbb1c59dd35ee340bda80a7aca473b09ec28fe5eafbd0a00caf656ceb"]; +const PRECACHE = ["/customer-app/apple-touch-icon.png", "/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/customer-app/brand-logo.png", "/customer-app/favicon.ico", "/customer-app/icon-192.png", "/customer-app/icon-512.png", "/customer-app/icon-maskable-192.png", "/customer-app/icon-maskable-512.png", "/customer-app/manifest.webmanifest", "/customer-app/index.html", "/customer-app/_expo/static/js/web/bundle.js?v=978bc9cd414a85aa91efb94b5142d95e732a9150d325c9855a0c1eeeed236197"]; // 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 04e7e539fd2631adb1fdd18f4b945ce5e9e5a022..3f74466f43fc82e4282f9953a7896c73149d81dd 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 82ea4df3327861632c102d3c0de9dd53a83486a5..8d67281995b3452f545a3a0ab8699e6b547fc747 100644 --- a/display-app/_expo/static/js/web/bundle.js +++ b/display-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1492]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1493]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1488,1491]); +__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])},7,[8,10,17,692,1489,1492]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1226,1227,1232,1236,1238,1245,1299,1300,1301,1302,1303,1304,1306,1307,1308,1309,1313,1316,1317,1318,1319,1322,1397,1398,1399,1401,1443,1444,1487]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1226,1227,1232,1236,1238,1245,1299,1300,1301,1302,1303,1304,1306,1307,1308,1309,1313,1316,1317,1318,1319,1322,1398,1399,1400,1402,1444,1445,1488]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1402,8 +1402,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1319,[13,17,777,1320,1154,1244,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1320,[812,843,17,85,777,845,851,1154,1321,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1321,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1395,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1348,1108,1349,1355,1357,1361,1366,1360,1367,1370,1371,1117,1095,1096,862,1376,1209,1377,1219,1211,995,1382,1387,1388,1054,1052,1119,1390,1391,1392,1071,1172,1393,1171,1162,853,1338,1394,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1322,[13,17,856,1323,1396,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1323,[1053,779,805,806,1324,813,1325,1094,843,1140,1326,1327,1328,1091,1122,1329,1330,1335,1336,1204,1337,856,1342,1343,1344,1115,1113,920,1345,1153,891,1104,1346,17,1072,1179,1018,1087,1347,21,378,363,385,278,85,409,1348,19,777,1220,1224,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1349,1108,1350,1356,1358,1362,1367,1361,1368,1371,1372,1117,1095,1096,862,1377,1209,1378,1219,1211,995,1383,1388,1389,1054,1052,1119,1391,1392,1393,1071,1172,1394,1171,1162,853,1338,1395,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1326,[]); @@ -1428,151 +1428,152 @@ __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,"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},1345,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1346,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1347,[17,85,780,804,8]); -__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},1348,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1349,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1350,1352,1351,998,876,1108,1353,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1350,[813,843,17,1351,85,842,804,777,1109,1352,1110,8]); -__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},1351,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1352,[1351,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1353,[17,368,278,85,842,982,1354,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1354,[982,993,856,928,899]); -__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])},1355,[17,219,385,85,804,777,1172,1356,8]); -__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},1356,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1357,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1358,841,863,1096,1359,804,777,1360,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1358,[]); -__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},1359,[]); -__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)},1360,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1361,[805,813,17,266,319,219,385,85,409,804,857,1362,777,999,916,1335,1364,880,1365,1366,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1362,[17,219,85,1363,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1363,[]); -__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||'')}},1364,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1366,[17,831,928,899,1365]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1367,[843,841,998,1368,1369]); -__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])},1368,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1369,[]); -__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])},1370,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1371,[1372,843,1095,998,17,85,777,1098,858,1116,1367,1096,863,1093,1117,1118,1119,804,1327,1374,1375,1115,1344,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1372,[17,362,385,85,858,920,876,996,1373,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1373,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1376,[1172,1372,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1360,858,998,845,1089,1076,1305,804,1327,1374,1375,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1377,[812,17,219,385,85,777,858,998,1378,804,1379,1381,8]); -__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))},1378,[]); -__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)}},1379,[831,858,998,1378,1380,1381]); -__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`},1380,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1381,[219,1380]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1382,[843,17,1183,1172,385,85,995,998,862,863,804,777,1383,1386,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1383,[1384,854,843,17,264,378,385,278,85,858,995,998,1385,863,804,1026,777,1386,1339,899,1327,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1384,[]); -__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)}},1385,[862,863,861]); -__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')},1386,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1388,[]); -__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},1389,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1390,[843,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.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1391,[17,385,85,777,1390,804,1347,8]); -__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]},1392,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1393,[17,1172,385,85,409,777,8]); -__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()}}},1394,[17,1005,876,926,816,1006,916,1339,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1395,[805,813,857,17,219,385,85,409,899,804,777,1335,1396,8]); -__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}})()},1396,[]); -__d(function(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]})}},1397,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1348,[219]); +__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},1349,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1350,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1351,1353,1352,998,876,1108,1354,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1351,[813,843,17,1352,85,842,804,777,1109,1353,1110,8]); +__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},1352,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1353,[1352,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1354,[17,368,278,85,842,982,1355,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1355,[982,993,856,928,899]); +__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])},1356,[17,219,385,85,804,777,1172,1357,8]); +__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},1357,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1358,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1359,841,863,1096,1360,804,777,1361,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1359,[]); +__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},1360,[]); +__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)},1361,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1362,[805,813,17,266,319,219,385,85,409,804,857,1363,777,999,916,1335,1365,880,1366,1367,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1363,[17,219,85,1364,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1364,[]); +__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||'')}},1365,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1367,[17,831,928,899,1366]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1368,[843,841,998,1369,1370]); +__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])},1369,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1370,[]); +__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])},1371,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1372,[1373,843,1095,998,17,85,1348,777,1098,858,1116,1368,1096,863,1093,1117,1118,1119,804,1327,1375,1376,1115,1344,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1373,[17,362,385,85,858,920,876,996,1374,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1374,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1377,[1172,1373,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1361,858,998,845,1089,1076,1305,804,1327,1375,1376,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1378,[812,17,219,385,85,777,858,998,1379,804,1380,1382,8]); +__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))},1379,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1380,[831,858,998,1379,1381,1382]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1381,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1382,[219,1381]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1383,[843,17,1183,1172,385,85,995,998,862,863,804,777,1384,1387,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1384,[1385,854,843,17,264,378,385,278,85,858,995,998,1386,863,804,1026,777,1387,1339,899,1327,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1385,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1386,[862,863,861]); +__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')},1387,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1389,[]); +__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},1390,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1391,[843,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.CancellationsSection=function({items:e,dayWord:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1392,[17,385,85,777,1391,804,1347,8]); +__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]},1393,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1394,[17,1172,385,85,409,777,8]); +__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()}}},1395,[17,1005,876,926,816,1006,916,1339,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1396,[805,813,857,17,219,385,85,409,899,804,777,1335,1397,8]); +__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}})()},1397,[]); __d(function(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]})}},1398,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1399,[13,17,1400,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1400,[]); -__d(function(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]})}},1401,[13,17,856,1402,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1402,[1403,1407,813,912,1072,1408,1203,1204,1028,1025,1026,1409,1411,1414,1153,891,978,1416,975,880,1031,1032,1417,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1418,1066,1084,1086,1081,1027,1010,1057,1425,1426,1427,1436,1437,920,219,1225,1176,1182,1433,1196,1193,1442,1179,878,1206,1207,884,776,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1403,[812,17,1018,378,85,1108,1109,1349,1382,777,995,998,863,804,1057,999,1404,1405,1020,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WipeDevice=function(n){return null}},1404,[]); -__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])},1405,[17,85,777,998,1406,842,804,1038,928,8]); -__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):''},1406,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1407,[17,85,777,1057,899,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1408,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1409,[899,17,264,219,85,1264,777,1241,1244,804,1410,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1410,[17,219,85,777,1241,8]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1411,[17,779,85,777,845,1241,1412,1413,804,8]); -__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'},1412,[845]); -__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()})},1413,[899,1412,1244]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1414,[805,1415,17,85,777,851,1241,1242,1243,899,1244,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1415,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1416,[219,976]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1417,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1418,[805,1415,1095,1251,1419,812,822,1117,1118,1091,1122,1420,1114,1119,1390,1391,1057,1327,996,1120,1089,841,1369,1125,1422,1220,1423,1382,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1424,1211,899,1180,1387,862,8]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1419,[806,17,85,777,899,1255,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1420,[17,385,85,1421,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1421,[]); -__d(function(_g,_r,i,a,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'}):''},1422,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1423,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1424,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1425,[17,1383,1057,8]); -__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])},1426,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1427,[820,896,1428,17,219,85,777,816,876,895,1000,897,899,1435,804,880,1163,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1428,[812,891,1140,899,780,1209,1211,17,264,362,219,385,85,409,864,777,858,1220,876,851,863,804,1178,1057,853,1055,1429,1161,1433,1434,1139,1146,1145,1008,839,1142,1149,1432,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1429,[886,779,816,813,822,862,1039,1430,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1432,8]); -__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})({})},1430,[482,1431]); -__d(function(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={}},1431,[]); -__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)}},1432,[816,876,805]); -__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1433,[812,17,1234,1026,854,362,385,85,777,876,851,863,804,1178,1057,1432,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1434,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1435,[]); -__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)','')},1436,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1437,[1438,17,219,24,85,856,1439,920,804,1441,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1438,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1439,[17,278,85,777,857,804,1440,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1440,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1441,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1442,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1429,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); -__d(function(g,r,i,a,m,e,d){"use strict";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]})}},1443,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1444,[1445,899,778,1396,1447,995,13,1474,479,17,368,319,219,24,85,805,857,1065,856,1476,19,858,998,876,804,1437,920,988,1479,1480,1028,1104,880,1008,914,1482,1366,8,1483,1484,1485,1486]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1445,[880,812,17,219,366,85,777,1446,899,804,1182,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1446,[]); -__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])},1447,[1448,1471,1473]); -__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)}}},1448,[198,1449,1452,1466,1467,1468,1469,1470]); -__d(function(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}},1449,[198,1450]); -__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}},1450,[1451]); -__d(function(g,r,i,a,m,e,d){},1451,[]); -__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)}},1452,[1453,198,1449,1466,1467]); -__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]}})})},1453,[1454,1455,1465]); -__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()}})}},1454,[1455,1459,1464]); -__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}}},1455,[198,355,1456,1460,1461,1462,1463,1459,1464]); -__d(function(g,r,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}},1456,[198,1457,322,263,1458,1459]); -__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])},1457,[487]); -__d(function(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}}},1458,[198,322]); -__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},1459,[]); -__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}},1460,[]); -__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}},1461,[]); -__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])},1462,[1460]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1463,[]); -__d(function(g,r,i,a,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},1464,[355,1458]); -__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])},1465,[17,1455]); -__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}},1466,[1453,198]); -__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])},1467,[1453,1466]); -__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}},1468,[1449]); -__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])},1469,[198,1449,1452,1450]); -__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})({})},1470,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]))},1471,[198,37,1472]); -__d(function(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')},1472,[198]); -__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]}},1473,[17,1448]); -__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]}})})},1474,[1475]); -__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(){}},1475,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1476,[17,24,85,409,777,857,920,899,880,805,804,1477,1478,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1477,[]); -__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])},1478,[17,85,777,804,8]); -__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()})},1479,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1480,[813,779,17,974,385,85,856,899,976,804,777,1335,971,880,1481,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SyncDeviceActions=function(){return null}},1481,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1482,[]); -__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"},1483,[]); -__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"},1484,[]); -__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"},1485,[]); -__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"},1486,[]); -__d(function(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]})}},1487,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1488,[1489]); -__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},1489,[8,1490,574]); -__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}))}}},1490,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1491,[]); -__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})}}},1492,[8,482,17,253,634]); +__d(function(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]})}},1399,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1400,[13,17,1401,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1401,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1402,[13,17,856,1403,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1403,[1404,1408,813,912,1072,1409,1203,1204,1028,1025,1026,1410,1412,1415,1153,891,978,1417,975,880,1031,1032,1418,914,1008,915,17,1155,1220,1224,1197,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1426,1427,1428,1437,1438,920,219,1225,1176,1182,1434,1196,1193,1443,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1404,[812,17,1018,378,85,1108,1109,1350,1383,777,995,998,863,804,1057,999,1405,1406,1020,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WipeDevice=function(n){return null}},1405,[]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1406,[17,85,777,998,1407,842,804,1038,928,8]); +__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):''},1407,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1408,[17,85,777,1057,899,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1409,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1410,[899,17,264,219,85,1264,777,1241,1244,804,1411,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1411,[17,219,85,777,1241,8]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1412,[17,779,85,777,845,1241,1413,1414,804,8]); +__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'},1413,[845]); +__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()})},1414,[899,1413,1244]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1415,[805,1416,17,85,777,851,1241,1242,1243,899,1244,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1416,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1417,[219,976]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1418,[17,85,777,804,914,1022,899,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1416,1095,1251,1420,812,822,1117,1118,1091,1122,1421,1114,1119,1391,1392,1057,1327,996,1120,1089,841,1370,1125,1423,1220,1424,1383,1078,1055,1090,17,85,777,1347,858,845,851,863,1305,804,1178,1098,1115,998,1344,1062,1162,1425,1211,899,1180,1388,862,8]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1420,[806,17,85,777,899,1255,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1421,[17,385,85,1422,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1422,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1423,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1424,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1425,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1426,[17,1384,1057,8]); +__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])},1427,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1428,[820,896,1429,17,219,85,777,816,876,895,1000,897,899,1436,804,880,1163,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1429,[812,891,1140,899,780,1209,1211,17,264,362,219,385,85,409,864,777,858,1220,876,851,863,804,1178,1057,853,1055,1430,1161,1434,1435,1139,1146,1145,1008,839,1142,1149,1433,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1430,[886,779,816,813,822,862,1039,1431,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1433,8]); +__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})({})},1431,[482,1432]); +__d(function(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={}},1432,[]); +__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)}},1433,[816,876,805]); +__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1434,[812,17,1234,1026,854,362,385,85,777,876,851,863,804,1178,1057,1433,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1435,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1436,[]); +__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)','')},1437,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1438,[1439,17,219,24,85,856,1440,920,804,1442,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1439,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1440,[17,278,85,777,857,804,1441,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1441,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1442,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1443,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1430,1162,860,1180,853,1178,884,1344,998,843,1115,1193,1200,1071,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1444,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1445,[1446,899,778,1397,1448,995,13,1475,479,17,368,319,219,24,85,805,857,1065,856,1477,19,858,998,876,804,1438,920,988,1480,1481,1028,1104,880,1008,914,1483,1367,8,1484,1485,1486,1487]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1446,[880,812,17,219,366,85,777,1447,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1447,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1448,[1449,1472,1474]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1449,[198,1450,1453,1467,1468,1469,1470,1471]); +__d(function(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}},1450,[198,1451]); +__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}},1451,[1452]); +__d(function(g,r,i,a,m,e,d){},1452,[]); +__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)}},1453,[1454,198,1450,1467,1468]); +__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]}})})},1454,[1455,1456,1466]); +__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()}})}},1455,[1456,1460,1465]); +__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}}},1456,[198,355,1457,1461,1462,1463,1464,1460,1465]); +__d(function(g,r,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}},1457,[198,1458,322,263,1459,1460]); +__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])},1458,[487]); +__d(function(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}}},1459,[198,322]); +__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},1460,[]); +__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}},1461,[]); +__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}},1462,[]); +__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])},1463,[1461]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1464,[]); +__d(function(g,r,i,a,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},1465,[355,1459]); +__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])},1466,[17,1456]); +__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}},1467,[1454,198]); +__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])},1468,[1454,1467]); +__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}},1469,[1450]); +__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])},1470,[198,1450,1453,1451]); +__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})({})},1471,[]); +__d(function(g,r,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]))},1472,[198,37,1473]); +__d(function(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')},1473,[198]); +__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]}},1474,[17,1449]); +__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]}})})},1475,[1476]); +__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(){}},1476,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1477,[17,24,85,409,777,857,920,899,880,805,804,1478,1479,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1478,[]); +__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])},1479,[17,85,777,804,8]); +__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()})},1480,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1481,[813,779,17,974,385,85,856,899,976,804,777,1335,971,880,1482,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SyncDeviceActions=function(){return null}},1482,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1483,[]); +__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"},1484,[]); +__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"},1485,[]); +__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"},1486,[]); +__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"},1487,[]); +__d(function(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]})}},1488,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1489,[1490]); +__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},1490,[8,1491,574]); +__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}))}}},1491,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1492,[]); +__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})}}},1493,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/display-app/admin.html b/display-app/admin.html index 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 386ce2b4feca1dab710c351a7c186ee71d9dab03..a5ed6ce3c177d5e7f446ba27569b040d26d0c6d7 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 aa9e939b94851bc14c5744b8636f18750774c8e2..4421bf4586970602349d79cc36a4c5bc065b3964 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-1656cc0a5c"; +const V = "cc-display-80c7f0ba82"; const BASE = "/display-app/"; -const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=1656cc0a5c4003e4a4d9467acdce417a050281478ae3a1dd4293fd638b763b0c"]; +const PRECACHE = ["/display-app/apple-touch-icon.png", "/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/display-app/brand-logo.png", "/display-app/favicon.ico", "/display-app/icon-192.png", "/display-app/icon-512.png", "/display-app/icon-maskable-192.png", "/display-app/icon-maskable-512.png", "/display-app/manifest.webmanifest", "/display-app/index.html", "/display-app/_expo/static/js/web/bundle.js?v=80c7f0ba825923d7615ead9fd2234810e358eaeb6c07a6962fe8e953b9ba391e"]; // 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 3f417948536c9a20259f3c6a0035a6410b0b2b75..e5c368cef26d944cbaa26f7771f6b45e4606c332 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 6524e99622c485e2ab4e4467b3a5650ba5e4bf91..61a5ef56de12a9de25898c0de8a4d0e2734f1f9a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ -Cover Charge: try the apps (v0.3.12.211) +Cover Charge: try the apps (v0.3.12.212) @@ -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.211)

+

Cover Charge: try the apps (v0.3.12.212)

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

+

Cover Charge v0.3.12.212

diff --git a/owner-app/_expo/static/js/web/bundle.js b/owner-app/_expo/static/js/web/bundle.js index 685ad4295e05c57f248cb6aee7b90cb09bc6273f..21c4e10449dec2b7c44dd529f54a156ae16f3815 100644 --- a/owner-app/_expo/static/js/web/bundle.js +++ b/owner-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1633]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1634]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1629,1632]); +__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])},7,[8,10,17,692,1630,1633]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1414,1415,1416,1583,1588,1589,1628]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1415,1416,1417,1584,1589,1590,1629]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1419,8 +1419,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1336,[13,17,777,1337,1154,1263,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1412,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1365,1108,1366,1372,1374,1378,1383,1377,1384,1387,1388,1117,1095,1096,862,1393,1230,1394,1240,1232,995,1399,1404,1405,1054,1052,1119,1407,1408,1409,1071,1172,1410,1171,1162,853,1355,1411,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1445,275 +1445,276 @@ __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,"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},1362,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1363,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1364,[17,85,780,804,8]); -__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},1365,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1366,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1367,1369,1368,998,876,1108,1370,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1367,[813,843,17,1368,85,842,804,777,1109,1369,1110,8]); -__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},1368,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1369,[1368,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1370,[17,368,278,85,842,982,1371,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1371,[982,993,856,928,899]); -__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])},1372,[17,219,385,85,804,777,1172,1373,8]); -__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},1373,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1374,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1375,841,863,1096,1376,804,777,1377,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1375,[]); -__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},1376,[]); -__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)},1377,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1378,[805,813,17,266,319,219,385,85,409,804,857,1379,777,999,916,1352,1381,880,1382,1383,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1379,[17,219,85,1380,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1380,[]); -__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||'')}},1381,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1383,[17,831,928,899,1382]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1384,[843,841,998,1385,1386]); -__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])},1385,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1386,[]); -__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])},1387,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1388,[1389,843,1095,998,17,85,777,1098,858,1116,1384,1096,863,1093,1117,1118,1119,804,1344,1391,1392,1115,1361,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1389,[17,362,385,85,858,920,876,996,1390,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1390,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1393,[1172,1389,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1377,858,998,845,1089,1076,1322,804,1344,1391,1392,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1394,[812,17,219,385,85,777,858,998,1395,804,1396,1398,8]); -__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))},1395,[]); -__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)}},1396,[831,858,998,1395,1397,1398]); -__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`},1397,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1398,[219,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}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1399,[843,17,1189,1172,385,85,995,998,862,863,804,777,1400,1403,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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})})]})})}},1400,[1401,854,843,17,264,378,385,278,85,858,995,998,1402,863,804,1026,777,1403,1356,899,1344,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1401,[]); -__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)}},1402,[862,863,861]); -__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')},1403,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1405,[]); -__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},1406,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1407,[843,1385]); -__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1408,[17,385,85,777,1407,804,1364,8]); -__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]},1409,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1410,[17,1172,385,85,409,777,8]); -__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()}}},1411,[17,1005,876,926,816,1006,916,1356,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1412,[805,813,857,17,219,385,85,409,899,804,777,1352,1413,8]); -__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}})()},1413,[]); -__d(function(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]})}},1414,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1365,[219]); +__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},1366,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1367,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1368,1370,1369,998,876,1108,1371,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1368,[813,843,17,1369,85,842,804,777,1109,1370,1110,8]); +__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},1369,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1370,[1369,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1371,[17,368,278,85,842,982,1372,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1372,[982,993,856,928,899]); +__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])},1373,[17,219,385,85,804,777,1172,1374,8]); +__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},1374,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1375,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1376,841,863,1096,1377,804,777,1378,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1376,[]); +__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},1377,[]); +__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)},1378,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1379,[805,813,17,266,319,219,385,85,409,804,857,1380,777,999,916,1352,1382,880,1383,1384,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1380,[17,219,85,1381,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1381,[]); +__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||'')}},1382,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1384,[17,831,928,899,1383]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1385,[843,841,998,1386,1387]); +__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])},1386,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1387,[]); +__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])},1388,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1389,[1390,843,1095,998,17,85,1365,777,1098,858,1116,1385,1096,863,1093,1117,1118,1119,804,1344,1392,1393,1115,1361,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1390,[17,362,385,85,858,920,876,996,1391,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1391,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1394,[1172,1390,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1378,858,998,845,1089,1076,1322,804,1344,1392,1393,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1395,[812,17,219,385,85,777,858,998,1396,804,1397,1399,8]); +__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))},1396,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); +__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')},1404,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1406,[]); +__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},1407,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1408,[843,1386]); +__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1409,[17,385,85,777,1408,804,1364,8]); +__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]},1410,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1411,[17,1172,385,85,409,777,8]); +__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()}}},1412,[17,1005,876,926,816,1006,916,1356,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1413,[805,813,857,17,219,385,85,409,899,804,777,1352,1414,8]); +__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}})()},1414,[]); __d(function(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]})}},1415,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1416,[13,17,1417,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1417,[17,856,1418,1559,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1418,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1419,1184,1057,884,1427,920,219,1432,1472,839,856,1474,1481,1482,1483,1190,1246,1484,1458,1485,1487,1456,1161,1230,1394,1232,1245,1489,1084,1086,1555,1556,1575,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1420,1095,1270,1421,812,822,1117,1118,1091,1122,1422,1114,1119,1407,1408,1057,1344,996,1120,1089,841,1386,1125,1424,1241,1425,1399,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1426,1232,899,1186,1404,862,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1420,[]); -__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])},1421,[806,17,85,777,899,1274,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1422,[17,385,85,1423,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1423,[]); -__d(function(_g,_r,i,a,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'}):''},1424,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1425,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1426,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1427,[1428,17,219,24,85,856,1429,920,804,1431,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1428,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1429,[17,278,85,777,857,804,1430,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1430,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1431,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1432,[843,1140,1433,17,780,1185,1074,1075,1425,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1443,1444,1149,1445,1162,853,1448,1188,1209,856,1207,1031,1032,1066,1098,1399,1153,1343,1466,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1433,[1053,1033,805,1420,812,1434,1435,1437,1438,1439,1203,1031,1032,1008,1014,17,385,85,777,841,1440,816,862,1055,861,804,1057,858,1187,926,927,876,1441,1394,998,1442,1005,1142,892,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1434,[812,17,85,777,1140,861,804,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1435,[843,17,219,85,777,858,998,1154,1263,899,1338,1436,8]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1436,[843,1285]); -__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])},1437,[17,85,777,998,1348,804,8]); -__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},1438,[17,85,777,998,863,1402,805,8]); -__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}},1439,[]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1440,[17,1033,85,804,777,1260,1263,8]); -__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)}},1441,[17,85,777,998,1368,804,8]); -__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1442,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1443,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1444,[17,385,85,777,804,1149,1443,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1445,[886,779,816,813,822,862,1039,1446,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); -__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})({})},1446,[482,1447]); -__d(function(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={}},1447,[]); -__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1448,[888,887,813,812,1039,1449,1450,1451,1452,1454,17,385,85,857,884,777,858,876,1455,998,886,878,851,804,1057,1456,1459,1463,1464,840,8]); -__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},1449,[]); -__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])},1450,[17,899]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1451,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1452,[880,812,17,219,366,85,777,1453,899,804,1188,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1453,[]); -__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}})]})}},1454,[17,385,777,899,804,1452,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1455,[]); -__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1456,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1445,1161,1457,1458,1139,1146,1145,1008,839,1142,1149,1221,8]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1457,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1458,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1459,[812,17,1018,378,85,1108,1109,1366,1399,777,995,998,863,804,1057,999,1460,1461,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1460,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1461,[17,85,777,998,1462,842,804,1038,928,8]); -__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):''},1462,[]); -__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."})]})})}},1463,[805,1420,17,85,777,858,876,8]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1464,[17,264,385,85,777,804,915,1465,8]); -__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1465,[928,899,876,856,915]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1466,[1467,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1468,1470,899,804,1057,1180,1471,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1467,[822]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1468,[839,1469]); -__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1469,[839]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1470,[908,906,1468]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1471,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1472,[17,264,85,777,899,863,804,856,1057,1473,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1473,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1474,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1475,804,856,1057,1476,1479,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1475,[1034]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1476,[812,17,362,385,278,85,777,1477,1478,804,1474,1057,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1477,[]); -__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)}))},1478,[824,831,834]); -__d(function(g,r,_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})]})}},1479,[17,385,85,777,860,1478,998,842,1480,1475,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1480,[]); -__d(function(g,_r,i,a,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}},1481,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1482,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1445,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1483,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1484,[831]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1485,[805,1420,843,1394,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1426,848,900,1486,8]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1486,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1487,[822,1050,856,1488,876,920,909,816,866,1490,1497,1499,1458,1500,1501,1503,1504,1161,1483,1505,1506,1507,1466,1202,1193,1485,1508,1456,1509,1510,17,1199,1182,1457,1445,1459,1515,1214,1521,1522,1472,1523,1448,1433,1524,1463,1525,886,1526,1527,1529,1188,1474,1530,1394,1476,1542,1081,1057,1203,1153,1546,1549,1552,1554]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1488,[17,378,219,385,85,19,777,1026,1340,876,804,1489,1190,1484,1057,8,260]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1489,[831]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1490,[812,1454,17,851,85,777,876,804,1057,884,885,1491,899,916,1031,1452,1492,1493,1495,996,1496,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1491,[]); -__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])},1492,[812,17,85,777,804,876,1356,1355,8]); -__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])},1493,[17,85,777,1494,804,8]); -__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},1494,[831,928,899,880]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1495,[17,85,777,804,914,1022,899,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1496,[928,899]); -__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1497,[17,85,777,835,876,1498,804,1057,8]); -__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'}},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.InfoHours=function(){const{r:e}=(0,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1499,[805,1033,891,1420,813,812,822,1263,1440,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1445,1221,8]); -__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])},1500,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); -__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])},1501,[1039,17,85,1502,814,857,777,876,804,1057,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1502,[812,17,219,385,85,780,814,804,777,8]); -__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])},1503,[17,1155,847,1057,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1504,[17,1032,1057,899,915,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1505,[17,1400,1057,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1506,[17,1467,85,780,777,858,1008,1469,804,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1507,[17,85,1349,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1508,[17,776,1057,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1509,[1467,17,85,777,858,1008,876,1055,1468,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1510,[805,1420,812,822,843,1511,1439,1489,1228,841,1263,899,1512,1514,1440,17,1098,1497,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1458,853,1026,1155,847,845,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1511,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1512,[899,17,264,219,85,1281,777,1260,1263,804,1513,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1513,[17,219,85,777,1260,8]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1514,[805,1420,17,85,777,851,1260,1261,1262,899,1263,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1515,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1516,1520,804,1057,1071,8]); -__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]}})})},1516,[1517,1519,1518]); -__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)}},1517,[843,1518]); -__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'}},1518,[]); -__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:'Assistant (server, with on-device fallback)',interpret:s}},1519,[1517,1218]); -__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},1520,[869,824,831,834]); -__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1521,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); -__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1522,[17,85,777,899,863,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1523,[813,812,822,17,219,385,85,777,1230,858,1520,1214,848,1232,1018,804,1027,1057,8]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1524,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1525,[17,385,85,777,876,1000,851,1001,804,840,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1526,[17,219,385,85,409,777,804,1378,857,1382,863,899,1383,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1527,[820,896,1456,17,219,85,777,816,876,895,1000,897,899,1528,804,880,1163,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1528,[]); -__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])},1529,[17,85,777,804,1435,1511,1057,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1530,[812,1033,779,17,385,85,777,876,1481,1531,1532,1533,804,1057,8]); -__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1531,[]); -__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}},1532,[]); -__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}},1533,[1534,1100,843,1535,1536,876,858,998,1481,1531,1532,1538,1537,1540,1541,996,997]); -__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))}}]},1534,[1064,1063,1023]); -__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1535,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); -__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1536,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1537,1535]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1537,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1538,1539]); -__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1538,[824,831,834]); -__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)}))},1539,[824,831,834]); -__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1540,[816,876,910,851,1537,1017,1071]); -__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))'},1541,[]); -__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1542,[17,362,85,777,804,1477,1538,1489,1539,1543,1217,1544,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1543,[824,831,834]); -__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])},1544,[17,85,777,804,1545,8]); -__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.'},1545,[824,831,834]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1546,[17,779,85,777,845,1260,1547,1548,804,8]); -__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'},1547,[845]); -__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()})},1548,[899,1547,1263]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1549,[17,85,777,858,1008,1550,891,839,1551,1020,804,1057,8]); -__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}))},1550,[824,831,834]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1551,[839,1009,1469]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1552,[812,17,319,85,777,804,1082,978,1553,1057,8]); -__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1554,[17,264,219,85,777,812,804,899,1430,1188,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1555,[219]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1557,[]); -__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1558,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1394,1087,1481,1086,1084,1232,1245,891,876,1032,1489,880,899,804,1340,1559,1057,1419,1161,1483,1485,1474,1458,1487,1555,1557,1565,1566,1567,1570,1573,8]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1559,[17,266,347,219,385,278,85,409,780,779,1340,1458,1487,1419,1161,1485,1483,1057,1026,777,858,876,863,899,880,804,1560,1561,1562,1563,1564,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1560,[]); -__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])},1561,[17,780,8]); -__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])},1562,[17,85,777,804,8]); -__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1563,[17,385,1163,1164,816,805,777,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1564,[17,219]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1565,[1560]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1566,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1567,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1419,1057,1458,1568,1557,1566,1569,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1568,[17,385,278,85,777,804,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1569,[17,85,780,777,804,1568,1566,8]); -__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1570,[17,264,385,85,780,777,858,876,1571,915,1215,1465,804,1561,1057,1568,1572,1566,1569,1567,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1571,[831,834,824]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1572,[915]); -__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1573,[17,85,777,804,1574,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1574,[]); -__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1575,[813,812,17,385,278,85,19,1363,857,1366,1230,1394,777,998,876,891,1032,1481,1087,1086,1084,1489,1232,880,804,1419,1161,1057,1432,1483,1474,1485,1458,1487,1576,1555,1578,1580,1582,1579,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1576,[17,278,85,1502,857,777,876,814,1459,804,1577,1578,1579,8]); -__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)})},1577,[]); -__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},1578,[17]); -__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})},1579,[17,85,777,804,8]); -__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."})]})]})}},1580,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1577,1578,1579,1581,8]); -__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])},1581,[876]); -__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1582,[17,85,777,876,1060,804,1577,1578,1579,1051,1581,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1583,[13,17,856,1584,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1584,[1459,1585,813,912,1072,1511,1209,1210,1028,1025,1026,1512,1546,1514,1153,891,978,1586,975,880,1031,1032,1495,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1505,1500,1527,1587,1427,920,219,1246,1182,1188,1457,1202,1199,1482,1185,878,1212,1213,884,776,899,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1585,[17,85,777,1057,899,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1586,[219,976]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1587,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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]})}},1588,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1589,[1452,899,778,1413,1590,995,13,1617,479,17,368,319,219,24,85,805,857,1065,856,1619,19,858,998,876,804,1427,920,988,1620,1621,1028,1104,880,1008,914,1623,1383,8,1624,1625,1626,1627]); -__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])},1590,[1591,1614,1616]); -__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)}}},1591,[198,1592,1595,1609,1610,1611,1612,1613]); -__d(function(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}},1592,[198,1593]); -__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}},1593,[1594]); -__d(function(g,r,i,a,m,e,d){},1594,[]); -__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)}},1595,[1596,198,1592,1609,1610]); -__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]}})})},1596,[1597,1598,1608]); -__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()}})}},1597,[1598,1602,1607]); -__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}}},1598,[198,355,1599,1603,1604,1605,1606,1602,1607]); -__d(function(g,r,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}},1599,[198,1600,322,263,1601,1602]); -__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])},1600,[487]); -__d(function(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}}},1601,[198,322]); -__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},1602,[]); -__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}},1603,[]); -__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}},1604,[]); -__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])},1605,[1603]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1606,[]); -__d(function(g,r,i,a,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},1607,[355,1601]); -__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])},1608,[17,1598]); -__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}},1609,[1596,198]); -__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])},1610,[1596,1609]); -__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}},1611,[1592]); -__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])},1612,[198,1592,1595,1593]); -__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})({})},1613,[]); -__d(function(g,r,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]))},1614,[198,37,1615]); -__d(function(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')},1615,[198]); -__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]}},1616,[17,1591]); -__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]}})})},1617,[1618]); -__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(){}},1618,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1619,[17,24,85,409,777,857,920,899,880,805,804,1560,1562,8]); -__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()})},1620,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1621,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1622,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1622,[17,1460,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1623,[]); -__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"},1624,[]); -__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"},1625,[]); -__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"},1626,[]); -__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"},1627,[]); -__d(function(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]})}},1628,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1629,[1630]); -__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},1630,[8,1631,574]); -__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}))}}},1631,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1632,[]); -__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})}}},1633,[8,482,17,253,634]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1429,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1437,[843,1285]); +__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])},1438,[17,85,777,998,1348,804,8]); +__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},1439,[17,85,777,998,863,1403,805,8]); +__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}},1440,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1441,[17,1033,85,804,777,1260,1263,8]); +__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)}},1442,[17,85,777,998,1369,804,8]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1443,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1444,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1445,[17,385,85,777,804,1149,1444,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1446,[886,779,816,813,822,862,1039,1447,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); +__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})({})},1447,[482,1448]); +__d(function(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={}},1448,[]); +__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1449,[888,887,813,812,1039,1450,1451,1452,1453,1455,17,385,85,857,884,777,858,876,1456,998,886,878,851,804,1057,1457,1460,1464,1465,840,8]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); +__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1457,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1446,1161,1458,1459,1139,1146,1145,1008,839,1142,1149,1221,8]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1458,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1459,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1460,[812,17,1018,378,85,1108,1109,1367,1400,777,995,998,863,804,1057,999,1461,1462,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1461,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1462,[17,85,777,998,1463,842,804,1038,928,8]); +__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):''},1463,[]); +__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."})]})})}},1464,[805,1421,17,85,777,858,876,8]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1465,[17,264,385,85,777,804,915,1466,8]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1466,[928,899,876,856,915]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1467,[1468,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1469,1471,899,804,1057,1180,1472,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1468,[822]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1469,[839,1470]); +__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1470,[839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1471,[908,906,1469]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); +__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)}))},1479,[824,831,834]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); +__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])},1493,[812,17,85,777,804,876,1356,1355,8]); +__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])},1494,[17,85,777,1495,804,8]); +__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},1495,[831,928,899,880]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1496,[17,85,777,804,914,1022,899,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1497,[928,899]); +__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1498,[17,85,777,835,876,1499,804,1057,8]); +__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'}},1499,[]); +__d(function(_g,_r,_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,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1500,[805,1033,891,1421,813,812,822,1263,1441,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1446,1221,8]); +__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])},1501,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); +__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])},1502,[1039,17,85,1503,814,857,777,876,804,1057,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1503,[812,17,219,385,85,780,814,804,777,8]); +__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])},1504,[17,1155,847,1057,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1505,[17,1032,1057,899,915,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1506,[17,1401,1057,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1507,[17,1468,85,780,777,858,1008,1470,804,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1515,[805,1421,17,85,777,851,1260,1261,1262,899,1263,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1516,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1517,1521,804,1057,1071,8]); +__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]}})})},1517,[1518,1520,1519]); +__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)}},1518,[843,1519]); +__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'}},1519,[]); +__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:'Assistant (server, with on-device fallback)',interpret:s}},1520,[1518,1218]); +__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},1521,[869,824,831,834]); +__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1522,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); +__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1523,[17,85,777,899,863,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1524,[813,812,822,17,219,385,85,777,1230,858,1521,1214,848,1232,1018,804,1027,1057,8]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1525,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1526,[17,385,85,777,876,1000,851,1001,804,840,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1527,[17,219,385,85,409,777,804,1379,857,1383,863,899,1384,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1528,[820,896,1457,17,219,85,777,816,876,895,1000,897,899,1529,804,880,1163,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1529,[]); +__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])},1530,[17,85,777,804,1436,1512,1057,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1531,[812,1033,779,17,385,85,777,876,1482,1532,1533,1534,804,1057,8]); +__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1532,[]); +__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}},1533,[]); +__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}},1534,[1535,1100,843,1536,1537,876,858,998,1482,1532,1533,1539,1538,1541,1542,996,997]); +__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))}}]},1535,[1064,1063,1023]); +__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1536,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); +__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1537,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1538,1536]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1538,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1539,1540]); +__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1539,[824,831,834]); +__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)}))},1540,[824,831,834]); +__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1541,[816,876,910,851,1538,1017,1071]); +__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))'},1542,[]); +__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1543,[17,362,85,777,804,1478,1539,1490,1540,1544,1217,1545,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1544,[824,831,834]); +__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])},1545,[17,85,777,804,1546,8]); +__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.'},1546,[824,831,834]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1547,[17,779,85,777,845,1260,1548,1549,804,8]); +__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'},1548,[845]); +__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()})},1549,[899,1548,1263]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1550,[17,85,777,858,1008,1551,891,839,1552,1020,804,1057,8]); +__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}))},1551,[824,831,834]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1559,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1395,1087,1482,1086,1084,1232,1245,891,876,1032,1490,880,899,804,1340,1560,1057,1420,1161,1484,1486,1475,1459,1488,1556,1558,1566,1567,1568,1571,1574,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1560,[17,266,347,219,385,278,85,409,780,779,1340,1459,1488,1420,1161,1486,1484,1057,1026,777,858,876,863,899,880,804,1561,1562,1563,1564,1565,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1561,[]); +__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])},1562,[17,780,8]); +__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])},1563,[17,85,777,804,8]); +__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1564,[17,385,1163,1164,816,805,777,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1565,[17,219]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1566,[1561]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1567,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1568,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1420,1057,1459,1569,1558,1567,1570,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1569,[17,385,278,85,777,804,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1570,[17,85,780,777,804,1569,1567,8]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1571,[17,264,385,85,780,777,858,876,1572,915,1215,1466,804,1562,1057,1569,1573,1567,1570,1568,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1572,[831,834,824]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1573,[915]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1574,[17,85,777,804,1575,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1575,[]); +__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1576,[813,812,17,385,278,85,19,1363,857,1367,1230,1395,777,998,876,891,1032,1482,1087,1086,1084,1490,1232,880,804,1420,1161,1057,1433,1484,1475,1486,1459,1488,1577,1556,1579,1581,1583,1580,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1577,[17,278,85,1503,857,777,876,814,1460,804,1578,1579,1580,8]); +__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)})},1578,[]); +__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},1579,[17]); +__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})},1580,[17,85,777,804,8]); +__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."})]})]})}},1581,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1578,1579,1580,1582,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(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]})}},1589,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1590,[1453,899,778,1414,1591,995,13,1618,479,17,368,319,219,24,85,805,857,1065,856,1620,19,858,998,876,804,1428,920,988,1621,1622,1028,1104,880,1008,914,1624,1384,8,1625,1626,1627,1628]); +__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])},1591,[1592,1615,1617]); +__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)}}},1592,[198,1593,1596,1610,1611,1612,1613,1614]); +__d(function(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}},1593,[198,1594]); +__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}},1594,[1595]); +__d(function(g,r,i,a,m,e,d){},1595,[]); +__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)}},1596,[1597,198,1593,1610,1611]); +__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]}})})},1597,[1598,1599,1609]); +__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()}})}},1598,[1599,1603,1608]); +__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}}},1599,[198,355,1600,1604,1605,1606,1607,1603,1608]); +__d(function(g,r,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}},1600,[198,1601,322,263,1602,1603]); +__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])},1601,[487]); +__d(function(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}}},1602,[198,322]); +__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},1603,[]); +__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}},1604,[]); +__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}},1605,[]); +__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])},1606,[1604]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1607,[]); +__d(function(g,r,i,a,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},1608,[355,1602]); +__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])},1609,[17,1599]); +__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}},1610,[1597,198]); +__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])},1611,[1597,1610]); +__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}},1612,[1593]); +__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])},1613,[198,1593,1596,1594]); +__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})({})},1614,[]); +__d(function(g,r,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]))},1615,[198,37,1616]); +__d(function(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')},1616,[198]); +__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]}},1617,[17,1592]); +__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]}})})},1618,[1619]); +__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(){}},1619,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1620,[17,24,85,409,777,857,920,899,880,805,804,1561,1563,8]); +__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()})},1621,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1622,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1623,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1623,[17,1461,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1624,[]); +__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"},1625,[]); +__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"},1626,[]); +__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"},1627,[]); +__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"},1628,[]); +__d(function(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]})}},1629,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1630,[1631]); +__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},1631,[8,1632,574]); +__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}))}}},1632,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1633,[]); +__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})}}},1634,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/owner-app/admin.html b/owner-app/admin.html index a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 ae7f1541e1e60c77799fe33574f6a396b83d065c..3d77bfaaaaef04149f5924f1e70526b1fd095217 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 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 200cfa876193d7d061e459db5caec39dbc35c615..f0003ff65b44d6392a922cefa9f9e57e35e0275a 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-ba6202ab23"; +const V = "cc-owner-b86fa063d0"; const BASE = "/owner-app/"; -const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=ba6202ab234566c631e1314d9990e0b94569341c61ae534ba2cff64bcd94c78c"]; +const PRECACHE = ["/owner-app/apple-touch-icon.png", "/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-app/brand-logo.png", "/owner-app/favicon.ico", "/owner-app/icon-192.png", "/owner-app/icon-512.png", "/owner-app/icon-maskable-192.png", "/owner-app/icon-maskable-512.png", "/owner-app/manifest.webmanifest", "/owner-app/index.html", "/owner-app/_expo/static/js/web/bundle.js?v=b86fa063d0c111c6dbff9538456e4ccbf1e72aae8c182bf74dbe0c9a364deed4"]; // 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 a758e0a291054290517a27895e41934d369c157d..639e5d4621509fbc893117c9860e3e0fd77c8185 100644 --- a/owner-app/team.html +++ b/owner-app/team.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/_expo/static/js/web/bundle.js b/owner-desktop/_expo/static/js/web/bundle.js index ea394d670eb470d84100f360baaa8fb9143e2cbc..da8f08f7df0a443a8b1b0abda42a77d02778d14a 100644 --- a/owner-desktop/_expo/static/js/web/bundle.js +++ b/owner-desktop/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1633]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1634]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1629,1632]); +__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])},7,[8,10,17,692,1630,1633]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1414,1415,1416,1583,1588,1589,1628]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1247,1248,1253,1255,1257,1264,1316,1317,1318,1319,1320,1321,1323,1324,1325,1326,1330,1333,1334,1335,1336,1339,1415,1416,1417,1584,1589,1590,1629]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1419,8 +1419,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1336,[13,17,777,1337,1154,1263,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1337,[812,843,17,85,777,845,851,1154,1338,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1338,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1412,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1365,1108,1366,1372,1374,1378,1383,1377,1384,1387,1388,1117,1095,1096,862,1393,1230,1394,1240,1232,995,1399,1404,1405,1054,1052,1119,1407,1408,1409,1071,1172,1410,1171,1162,853,1355,1411,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1339,[13,17,856,1340,1413,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1340,[1053,779,805,806,1341,813,1342,1094,843,1140,1343,1344,1345,1091,1122,1346,1347,1352,1353,1210,1354,856,1359,1360,1361,1115,1113,920,1362,1153,891,1104,1363,17,1072,1185,1018,1087,1364,21,378,363,385,278,85,409,1365,19,777,1241,1245,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1366,1108,1367,1373,1375,1379,1384,1378,1385,1388,1389,1117,1095,1096,862,1394,1230,1395,1240,1232,995,1400,1405,1406,1054,1052,1119,1408,1409,1410,1071,1172,1411,1171,1162,853,1355,1412,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1343,[]); @@ -1445,275 +1445,276 @@ __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,"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},1362,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1363,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1364,[17,85,780,804,8]); -__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},1365,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1366,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1367,1369,1368,998,876,1108,1370,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1367,[813,843,17,1368,85,842,804,777,1109,1369,1110,8]); -__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},1368,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1369,[1368,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1370,[17,368,278,85,842,982,1371,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1371,[982,993,856,928,899]); -__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])},1372,[17,219,385,85,804,777,1172,1373,8]); -__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},1373,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1374,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1375,841,863,1096,1376,804,777,1377,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1375,[]); -__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},1376,[]); -__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)},1377,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1378,[805,813,17,266,319,219,385,85,409,804,857,1379,777,999,916,1352,1381,880,1382,1383,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1379,[17,219,85,1380,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1380,[]); -__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||'')}},1381,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1383,[17,831,928,899,1382]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1384,[843,841,998,1385,1386]); -__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])},1385,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1386,[]); -__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])},1387,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1388,[1389,843,1095,998,17,85,777,1098,858,1116,1384,1096,863,1093,1117,1118,1119,804,1344,1391,1392,1115,1361,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1389,[17,362,385,85,858,920,876,996,1390,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1390,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1393,[1172,1389,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1377,858,998,845,1089,1076,1322,804,1344,1391,1392,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1394,[812,17,219,385,85,777,858,998,1395,804,1396,1398,8]); -__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))},1395,[]); -__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)}},1396,[831,858,998,1395,1397,1398]); -__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`},1397,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1398,[219,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}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1399,[843,17,1189,1172,385,85,995,998,862,863,804,777,1400,1403,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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})})]})})}},1400,[1401,854,843,17,264,378,385,278,85,858,995,998,1402,863,804,1026,777,1403,1356,899,1344,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1401,[]); -__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)}},1402,[862,863,861]); -__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')},1403,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1405,[]); -__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},1406,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1407,[843,1385]); -__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1408,[17,385,85,777,1407,804,1364,8]); -__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]},1409,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1410,[17,1172,385,85,409,777,8]); -__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()}}},1411,[17,1005,876,926,816,1006,916,1356,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1412,[805,813,857,17,219,385,85,409,899,804,777,1352,1413,8]); -__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}})()},1413,[]); -__d(function(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]})}},1414,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1365,[219]); +__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},1366,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1367,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1368,1370,1369,998,876,1108,1371,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1368,[813,843,17,1369,85,842,804,777,1109,1370,1110,8]); +__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},1369,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1370,[1369,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1371,[17,368,278,85,842,982,1372,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1372,[982,993,856,928,899]); +__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])},1373,[17,219,385,85,804,777,1172,1374,8]); +__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},1374,[]); +__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1375,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1376,841,863,1096,1377,804,777,1378,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1376,[]); +__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},1377,[]); +__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)},1378,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1379,[805,813,17,266,319,219,385,85,409,804,857,1380,777,999,916,1352,1382,880,1383,1384,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1380,[17,219,85,1381,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1381,[]); +__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||'')}},1382,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1384,[17,831,928,899,1383]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1385,[843,841,998,1386,1387]); +__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])},1386,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1387,[]); +__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])},1388,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1389,[1390,843,1095,998,17,85,1365,777,1098,858,1116,1385,1096,863,1093,1117,1118,1119,804,1344,1392,1393,1115,1361,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1390,[17,362,385,85,858,920,876,996,1391,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1391,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1394,[1172,1390,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1378,858,998,845,1089,1076,1322,804,1344,1392,1393,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1395,[812,17,219,385,85,777,858,998,1396,804,1397,1399,8]); +__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))},1396,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1397,[831,858,998,1396,1398,1399]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1398,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1399,[219,1398]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1400,[843,17,1189,1172,385,85,995,998,862,863,804,777,1401,1404,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1401,[1402,854,843,17,264,378,385,278,85,858,995,998,1403,863,804,1026,777,1404,1356,899,1344,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1402,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1403,[862,863,861]); +__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')},1404,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1406,[]); +__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},1407,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1408,[843,1386]); +__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1409,[17,385,85,777,1408,804,1364,8]); +__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]},1410,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1411,[17,1172,385,85,409,777,8]); +__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()}}},1412,[17,1005,876,926,816,1006,916,1356,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1413,[805,813,857,17,219,385,85,409,899,804,777,1352,1414,8]); +__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}})()},1414,[]); __d(function(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]})}},1415,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1416,[13,17,1417,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1417,[17,856,1418,1559,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1418,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1419,1184,1057,884,1427,920,219,1432,1472,839,856,1474,1481,1482,1483,1190,1246,1484,1458,1485,1487,1456,1161,1230,1394,1232,1245,1489,1084,1086,1555,1556,1575,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1419,[805,1420,1095,1270,1421,812,822,1117,1118,1091,1122,1422,1114,1119,1407,1408,1057,1344,996,1120,1089,841,1386,1125,1424,1241,1425,1399,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1426,1232,899,1186,1404,862,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1420,[]); -__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])},1421,[806,17,85,777,899,1274,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1422,[17,385,85,1423,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1423,[]); -__d(function(_g,_r,i,a,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'}):''},1424,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1425,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1426,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1427,[1428,17,219,24,85,856,1429,920,804,1431,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1428,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1429,[17,278,85,777,857,804,1430,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1430,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1431,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1432,[843,1140,1433,17,780,1185,1074,1075,1425,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1443,1444,1149,1445,1162,853,1448,1188,1209,856,1207,1031,1032,1066,1098,1399,1153,1343,1466,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1433,[1053,1033,805,1420,812,1434,1435,1437,1438,1439,1203,1031,1032,1008,1014,17,385,85,777,841,1440,816,862,1055,861,804,1057,858,1187,926,927,876,1441,1394,998,1442,1005,1142,892,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1434,[812,17,85,777,1140,861,804,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1435,[843,17,219,85,777,858,998,1154,1263,899,1338,1436,8]); -__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1436,[843,1285]); -__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])},1437,[17,85,777,998,1348,804,8]); -__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},1438,[17,85,777,998,863,1402,805,8]); -__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}},1439,[]); -__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1440,[17,1033,85,804,777,1260,1263,8]); -__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)}},1441,[17,85,777,998,1368,804,8]); -__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1442,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1443,[]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1444,[17,385,85,777,804,1149,1443,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1445,[886,779,816,813,822,862,1039,1446,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); -__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})({})},1446,[482,1447]); -__d(function(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={}},1447,[]); -__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1448,[888,887,813,812,1039,1449,1450,1451,1452,1454,17,385,85,857,884,777,858,876,1455,998,886,878,851,804,1057,1456,1459,1463,1464,840,8]); -__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},1449,[]); -__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])},1450,[17,899]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1451,[17,831,899]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1452,[880,812,17,219,366,85,777,1453,899,804,1188,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1453,[]); -__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}})]})}},1454,[17,385,777,899,804,1452,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1455,[]); -__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1456,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1445,1161,1457,1458,1139,1146,1145,1008,839,1142,1149,1221,8]); -__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1457,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1458,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1459,[812,17,1018,378,85,1108,1109,1366,1399,777,995,998,863,804,1057,999,1460,1461,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1460,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1461,[17,85,777,998,1462,842,804,1038,928,8]); -__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):''},1462,[]); -__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."})]})})}},1463,[805,1420,17,85,777,858,876,8]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1464,[17,264,385,85,777,804,915,1465,8]); -__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1465,[928,899,876,856,915]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1466,[1467,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1468,1470,899,804,1057,1180,1471,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1467,[822]); -__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1468,[839,1469]); -__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1469,[839]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1470,[908,906,1468]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1471,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1472,[17,264,85,777,899,863,804,856,1057,1473,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1473,[]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1474,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1475,804,856,1057,1476,1479,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1475,[1034]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1476,[812,17,362,385,278,85,777,1477,1478,804,1474,1057,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1477,[]); -__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)}))},1478,[824,831,834]); -__d(function(g,r,_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})]})}},1479,[17,385,85,777,860,1478,998,842,1480,1475,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1480,[]); -__d(function(g,_r,i,a,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}},1481,[813,17,266,347,219,385,85,831,777,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1482,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1445,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1483,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1484,[831]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1485,[805,1420,843,1394,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1426,848,900,1486,8]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1486,[17,85,777,858,851,1159,804,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1487,[822,1050,856,1488,876,920,909,816,866,1490,1497,1499,1458,1500,1501,1503,1504,1161,1483,1505,1506,1507,1466,1202,1193,1485,1508,1456,1509,1510,17,1199,1182,1457,1445,1459,1515,1214,1521,1522,1472,1523,1448,1433,1524,1463,1525,886,1526,1527,1529,1188,1474,1530,1394,1476,1542,1081,1057,1203,1153,1546,1549,1552,1554]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1488,[17,378,219,385,85,19,777,1026,1340,876,804,1489,1190,1484,1057,8,260]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1489,[831]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1490,[812,1454,17,851,85,777,876,804,1057,884,885,1491,899,916,1031,1452,1492,1493,1495,996,1496,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1491,[]); -__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])},1492,[812,17,85,777,804,876,1356,1355,8]); -__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])},1493,[17,85,777,1494,804,8]); -__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},1494,[831,928,899,880]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1495,[17,85,777,804,914,1022,899,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1496,[928,899]); -__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1497,[17,85,777,835,876,1498,804,1057,8]); -__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'}},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.InfoHours=function(){const{r:e}=(0,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1499,[805,1033,891,1420,813,812,822,1263,1440,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1445,1221,8]); -__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])},1500,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); -__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])},1501,[1039,17,85,1502,814,857,777,876,804,1057,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1502,[812,17,219,385,85,780,814,804,777,8]); -__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])},1503,[17,1155,847,1057,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1504,[17,1032,1057,899,915,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1505,[17,1400,1057,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1506,[17,1467,85,780,777,858,1008,1469,804,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1507,[17,85,1349,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1508,[17,776,1057,8]); -__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1509,[1467,17,85,777,858,1008,876,1055,1468,899,804,1242,1243,1057,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1510,[805,1420,812,822,843,1511,1439,1489,1228,841,1263,899,1512,1514,1440,17,1098,1497,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1458,853,1026,1155,847,845,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1511,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1512,[899,17,264,219,85,1281,777,1260,1263,804,1513,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1513,[17,219,85,777,1260,8]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1514,[805,1420,17,85,777,851,1260,1261,1262,899,1263,804,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1515,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1516,1520,804,1057,1071,8]); -__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]}})})},1516,[1517,1519,1518]); -__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)}},1517,[843,1518]); -__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'}},1518,[]); -__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:'Assistant (server, with on-device fallback)',interpret:s}},1519,[1517,1218]); -__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},1520,[869,824,831,834]); -__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1521,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); -__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1522,[17,85,777,899,863,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1523,[813,812,822,17,219,385,85,777,1230,858,1520,1214,848,1232,1018,804,1027,1057,8]); -__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1524,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1525,[17,385,85,777,876,1000,851,1001,804,840,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1526,[17,219,385,85,409,777,804,1378,857,1382,863,899,1383,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1527,[820,896,1456,17,219,85,777,816,876,895,1000,897,899,1528,804,880,1163,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1528,[]); -__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])},1529,[17,85,777,804,1435,1511,1057,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1530,[812,1033,779,17,385,85,777,876,1481,1531,1532,1533,804,1057,8]); -__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1531,[]); -__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}},1532,[]); -__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}},1533,[1534,1100,843,1535,1536,876,858,998,1481,1531,1532,1538,1537,1540,1541,996,997]); -__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))}}]},1534,[1064,1063,1023]); -__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1535,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); -__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1536,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1537,1535]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1537,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1538,1539]); -__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1538,[824,831,834]); -__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)}))},1539,[824,831,834]); -__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1540,[816,876,910,851,1537,1017,1071]); -__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))'},1541,[]); -__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1542,[17,362,85,777,804,1477,1538,1489,1539,1543,1217,1544,1057,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1543,[824,831,834]); -__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])},1544,[17,85,777,804,1545,8]); -__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.'},1545,[824,831,834]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1546,[17,779,85,777,845,1260,1547,1548,804,8]); -__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'},1547,[845]); -__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()})},1548,[899,1547,1263]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1549,[17,85,777,858,1008,1550,891,839,1551,1020,804,1057,8]); -__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}))},1550,[824,831,834]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1551,[839,1009,1469]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1552,[812,17,319,85,777,804,1082,978,1553,1057,8]); -__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1554,[17,264,219,85,777,812,804,899,1430,1188,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1555,[219]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1557,[]); -__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1558,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1394,1087,1481,1086,1084,1232,1245,891,876,1032,1489,880,899,804,1340,1559,1057,1419,1161,1483,1485,1474,1458,1487,1555,1557,1565,1566,1567,1570,1573,8]); -__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1559,[17,266,347,219,385,278,85,409,780,779,1340,1458,1487,1419,1161,1485,1483,1057,1026,777,858,876,863,899,880,804,1560,1561,1562,1563,1564,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1560,[]); -__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])},1561,[17,780,8]); -__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])},1562,[17,85,777,804,8]); -__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1563,[17,385,1163,1164,816,805,777,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1564,[17,219]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1565,[1560]); -__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1566,[]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1567,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1419,1057,1458,1568,1557,1566,1569,8]); -__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1568,[17,385,278,85,777,804,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1569,[17,85,780,777,804,1568,1566,8]); -__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1570,[17,264,385,85,780,777,858,876,1571,915,1215,1465,804,1561,1057,1568,1572,1566,1569,1567,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1571,[831,834,824]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1572,[915]); -__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1573,[17,85,777,804,1574,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1574,[]); -__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1575,[813,812,17,385,278,85,19,1363,857,1366,1230,1394,777,998,876,891,1032,1481,1087,1086,1084,1489,1232,880,804,1419,1161,1057,1432,1483,1474,1485,1458,1487,1576,1555,1578,1580,1582,1579,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1576,[17,278,85,1502,857,777,876,814,1459,804,1577,1578,1579,8]); -__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)})},1577,[]); -__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},1578,[17]); -__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})},1579,[17,85,777,804,8]); -__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."})]})]})}},1580,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1577,1578,1579,1581,8]); -__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])},1581,[876]); -__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1582,[17,85,777,876,1060,804,1577,1578,1579,1051,1581,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1583,[13,17,856,1584,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1584,[1459,1585,813,912,1072,1511,1209,1210,1028,1025,1026,1512,1546,1514,1153,891,978,1586,975,880,1031,1032,1495,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1419,1066,1084,1086,1081,1027,1010,1057,1505,1500,1527,1587,1427,920,219,1246,1182,1188,1457,1202,1199,1482,1185,878,1212,1213,884,776,899,8]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1585,[17,85,777,1057,899,8]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1586,[219,976]); -__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1587,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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]})}},1588,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1589,[1452,899,778,1413,1590,995,13,1617,479,17,368,319,219,24,85,805,857,1065,856,1619,19,858,998,876,804,1427,920,988,1620,1621,1028,1104,880,1008,914,1623,1383,8,1624,1625,1626,1627]); -__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])},1590,[1591,1614,1616]); -__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)}}},1591,[198,1592,1595,1609,1610,1611,1612,1613]); -__d(function(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}},1592,[198,1593]); -__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}},1593,[1594]); -__d(function(g,r,i,a,m,e,d){},1594,[]); -__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)}},1595,[1596,198,1592,1609,1610]); -__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]}})})},1596,[1597,1598,1608]); -__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()}})}},1597,[1598,1602,1607]); -__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}}},1598,[198,355,1599,1603,1604,1605,1606,1602,1607]); -__d(function(g,r,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}},1599,[198,1600,322,263,1601,1602]); -__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])},1600,[487]); -__d(function(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}}},1601,[198,322]); -__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},1602,[]); -__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}},1603,[]); -__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}},1604,[]); -__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])},1605,[1603]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1606,[]); -__d(function(g,r,i,a,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},1607,[355,1601]); -__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])},1608,[17,1598]); -__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}},1609,[1596,198]); -__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])},1610,[1596,1609]); -__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}},1611,[1592]); -__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])},1612,[198,1592,1595,1593]); -__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})({})},1613,[]); -__d(function(g,r,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]))},1614,[198,37,1615]); -__d(function(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')},1615,[198]); -__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]}},1616,[17,1591]); -__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]}})})},1617,[1618]); -__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(){}},1618,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1619,[17,24,85,409,777,857,920,899,880,805,804,1560,1562,8]); -__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()})},1620,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1621,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1622,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1622,[17,1460,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1623,[]); -__d(function(e,o,s,t,p,n,a){"use strict";p.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1624,[]); -__d(function(o,e,s,t,d,p,c){"use strict";d.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1625,[]); -__d(function(o,e,s,t,d,p,f){"use strict";d.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1626,[]); -__d(function(o,s,e,d,t,p,n){"use strict";t.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1627,[]); -__d(function(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]})}},1628,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1629,[1630]); -__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},1630,[8,1631,574]); -__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}))}}},1631,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1632,[]); -__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})}}},1633,[8,482,17,253,634]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1416,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1417,[13,17,1418,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return n.IS_CAR?(0,u.jsx)(t.CarApp,{}):(0,u.jsx)(p.OwnerApp,{})},r(d[0]);var n=r(d[1]),p=r(d[2]),t=r(d[3]),u=r(d[4])},1418,[17,856,1419,1560,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canSignOffHours",{enumerable:!0,get:function(){return ue}}),_e.barTabsFor=fe,_e.signOffSpeech=ge,_e.OwnerApp=function(){return H.IS_OWNER_DESKTOP?(0,le.jsx)(ae.DesktopGate,{phone:(0,le.jsx)(me,{})}):(0,ne.isDesktop)()?(0,le.jsx)(ie.DesktopShell,{}):(0,le.jsx)(me,{})};var t=_r(d[0]),s=_r(d[1]),o=_r(d[2]),r=_r(d[3]),n=_r(d[4]),a=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]),b=_r(d[11]),p=_r(d[12]),x=_r(d[13]),w=e(_r(d[14])),j=e(_r(d[15])),S=e(_r(d[16])),y=e(_r(d[17])),A=e(_r(d[18])),k=e(_r(d[19])),R=_r(d[20]),C=_r(d[21]),v=_r(d[22]),I=_r(d[23]),L=_r(d[24]),O=_r(d[25]),T=_r(d[26]),E=_r(d[27]),B=_r(d[28]),_=_r(d[29]),P=_r(d[30]),N=_r(d[31]);_r(d[32]);var $=_r(d[33]),D=_r(d[34]),M=_r(d[35]),H=_r(d[36]),W=_r(d[37]),V=_r(d[38]),F=_r(d[39]),U=_r(d[40]),z=_r(d[41]),q=_r(d[42]),G=_r(d[43]),K=_r(d[44]),Y=_r(d[45]);_r(d[46]);var J=_r(d[47]),Q=_r(d[48]),X=_r(d[49]),Z=_r(d[50]),ee=_r(d[51]),te=_r(d[52]),se=_r(d[53]),oe=_r(d[54]),re=_r(d[55]),ne=_r(d[56]),ae=_r(d[57]),ie=_r(d[58]),le=_r(d[59]);const de=[{id:'anchorage',name:'The Anchorage',place:'Harbour View, Dunure'},{id:'saltmarsh',name:'The Venue',place:'Fictional demo venue'}],ce=[{id:'home',label:'Home',icon:'home'},{id:'orders',label:'Orders',icon:'orders'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'forecast',label:'Forecast',icon:'forecast',can:L.CAN.forecasts},{id:'chat',label:'Chat',icon:'chat'},{id:'more',label:'More',icon:'more'}],ue=e=>L.CAN.manage(e)&&(!(0,o.isLive)()||(0,o.can)('rota.manage'));function fe(e,t){return'owner'===e||'manager'===e||t?[{id:'home',label:'Home',icon:'home'},{id:'signoff',label:'Sign off hours',short:'Sign off',icon:'signoff'},{id:'bookings',label:'Bookings',icon:'bookings'},{id:'rota',label:'Rota',icon:'rota'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'more',label:'More',icon:'more'}]:ce.filter(t=>!t.can||t.can(e)).map(e=>e)}function ge(e,t){const s=[e?`${e} earlier day${e>1?'s':''} to sign off`:'',t?`${t} correction request${t>1?'s':''}`:''].filter(Boolean);return"Sign off hours"+(s.length?`, ${s.join(' and ')}`:', nothing waiting')}const he={home:'Today',orders:'Orders',bookings:'Bookings',forecast:'Forecasts',chat:'Staff chat',more:'More'};function me(){const{rid:e,r:ne,role:ae,today:ie,now:ue,meId:me,me:be}=(0,B.useCtx)(3e4);(0,b.useTipsPosted)(e,ie,'staff'!==ae);const pe=(0,B.useSignedIn)();(0,u.useSoldOutLink)(!0,(pe?.name??be).replace(' (example)',''));const xe=(0,I.useOrders)(e),[we,je]=(0,x.useState)('home'),[Se,ye]=(0,x.useState)(null),[Ae,ke]=(0,x.useState)(!1),Re=(0,n.useLiveVenue)(),[Ce,ve]=(0,x.useState)(!1),Ie=(0,x.useRef)(null);(0,x.useEffect)(()=>{(0,B.ensureAttendance)(ie,ue),(0,Q.ensureChat)(ue)},[ie]),globalThis.__ccNow=ue.getTime();const Le=(0,Q.useChatUnread)().total,Oe=(0,x.useRef)({t:'home',s:null});Oe.current={t:we,s:Se};const Te=(0,x.useRef)([]),Ee=(0,c.useScrollMemory)(Ie),Be=(0,x.useCallback)((e,t=null)=>{'chat'!==e||'owner'!==ae&&'manager'!==ae||(e='more',t='chat');const s=Oe.current;s.t===e&&s.s===t||(Te.current=[...Te.current,{...s,y:Ee.leave()}].slice(-30),Ee.restore(0)),je(e),ye(t)},[ae]),Pe=(0,x.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Oe.current;let t=Te.current.pop();for(;t&&t.t===e.t&&t.s===e.s;)t=Te.current.pop();if(!t&&'home'===e.t&&!e.s)return!1;const s=t??{t:'home',s:null};return Ee.leave(),je(s.t),ye(s.s),Ee.restore(s.y??0),!0},[]);(0,f.useWebBack)(Pe);const Ne=(0,f.useInnerBackShown)();(0,x.useEffect)(()=>(se.useVoiceNav.setState({go:Be}),()=>se.useVoiceNav.setState({go:null})),[Be]),(0,x.useEffect)(()=>{h.PITCH&&(globalThis.__pitchGo=Be,globalThis.__pitchOwner=L.useOwner)},[Be]),(0,x.useEffect)(()=>{const e=w.default.addEventListener('hardwareBackPress',Pe);return()=>e.remove()},[Pe]),(0,x.useEffect)(()=>{const e=ce.find(e=>e.id===we);e?.can&&!e.can(ae)&&Be('home');const t=(0,K.pageFor)(Se);t?.can&&!t.can(ae)&&ye(null)},[ae]);const $e='more'===we?(0,K.pageFor)(Se):void 0,De=xe.filter(e=>(0,E.LIVE)(e)&&'new'===e.status).length,{unread:Me,list:He,read:We}=(0,J.useNotifications)();(0,ee.useAlertWatcher)(e,{nag:'staff'!==ae}),(0,te.useReviewAlerts)(e),(0,oe.useScheduledNotices)({rid:e,staffId:pe?.id??'',name:be,onOpen:e=>'bookings'===e?Be('bookings'):'chat'===e?Be('chat'):Be('more',e)}),(0,re.useOffRotaAlerts)({enabled:'staff'!==ae&&!!pe});const Ve=pe?.role??ae,Fe='owner'===Ve?'OWNER':'manager'===Ve?'MANAGER':'STAFF',Ue=(0,ee.useAlerts)(t=>t.history.filter(s=>s.rid===e&&(0,ee.isUnread)(t,s)&&!(0,ee.isCleared)(t,s)&&s.at>(t.seenAt[e]??0)).length),ze=(0,ee.useAlerts)(t=>t.todoSeen[e]),qe=Math.max(0,Me-He.filter(e=>!We[e.id]&&(ze??[]).includes(e.id)).length)+Ue;(0,ee.useAlertSeenSync)(e),(0,x.useEffect)(()=>{G.useShellBadges.setState({notifCount:qe})},[qe]);const Ge=(0,I.useBookings)(e).filter(e=>'pending'===e.status).length,Ke=L.CAN.manage(ae),Ye=(0,r.useOutstanding)(),Je=Ye.days.length+Ye.requests,Qe=fe(ae,Ke),Xe='more'===we&&'signoff'===Se?'signoff':'more'===we&&'rota'===Se?'rota':'more'===we&&'cashup'===Se?'cashup':'forecast'===we||'orders'===we&&Ke||'chat'===we&&Ke?'more':we,Ze=t.IS_ISOLATED_VENUE?[{id:e,name:ne.name,place:ne.location||ne.address||''}]:de,et=Ze.find(t=>t.id===e)??Ze[0],tt=pe?.ownerAccess&&'owner'!==pe.role?'owner privileges':pe?.managerAccess&&'staff'===pe.role?'manager privileges':'',st=(0,M.ownerHomeLayout)(ae,pe);(0,A.default)().width;return(0,le.jsxs)(R.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},edges:['top','left','right','bottom'],children:[(0,le.jsxs)(k.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:O.colours.border,gap:6},children:[(0,le.jsxs)(k.default,{style:{position:'absolute',top:4,right:6,zIndex:5,flexDirection:'row',alignItems:'center',gap:2},children:[(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Search",hitSlop:8,onPress:()=>Be('more','search'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(z.Icon,{name:"search",colour:O.colours.text})}),(0,le.jsx)(S.default,{testID:"bell",accessibilityRole:"button",accessibilityLabel:qe?`Notifications, ${qe} new`:'Notifications, nothing new',hitSlop:8,onPress:()=>Be('more','notifications'),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,le.jsxs)(k.default,{children:[(0,le.jsx)(z.Icon,{name:"bell",colour:O.colours.text}),qe?(0,le.jsx)(k.default,{style:{position:'absolute',right:-4,top:-4,backgroundColor:O.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,le.jsx)(C.T,{size:10,weight:"bold",children:qe})}):null]})})]}),(0,le.jsx)(k.default,{style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'70%'},children:(0,le.jsx)(k.default,{testID:"header-me-wrap",style:{alignItems:'flex-start'},children:(0,le.jsx)(S.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`Signed in as ${be}. Account and role${tt?`, ${tt}`:''}`,disabled:'owner'!==H.APP_VARIANT,onPress:()=>ve(!0),hitSlop:6,style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,le.jsxs)(C.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,le.jsx)(_.StaffAvatar,{id:me,size:24,ring:!1}),(0,le.jsxs)(k.default,{style:{flexShrink:1},children:[(0,le.jsxs)(C.T,{size:13,weight:"semibold",colour:O.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[pe?`${be} \xb7 ${pe.level??L.ROLE_LABEL[pe.role]}`:`${be} \xb7 ${L.ROLE_LABEL[ae]}`,'owner'===H.APP_VARIANT?' \u25be':'']}),tt?(0,le.jsx)(C.Muted,{center:!1,size:10,numberOfLines:1,children:tt}):null]})]})})})}),(0,le.jsx)(S.default,{accessibilityRole:"button",accessibilityLabel:"Switch venue",onPress:()=>ke(!0),style:{alignSelf:'center',maxWidth:420,width:'100%'},children:(0,le.jsx)(v.VenueHeaderBlock,{rid:e,name:ne.name,badge:Fe,place:`${'staff'===ae?'Staff preview \xb7 ':'Managers \xb7 '}${et.place}`})}),ae!==(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner')&&'owner'===H.APP_VARIANT?(0,le.jsx)(S.default,{onPress:()=>L.useOwner.getState().setPreviewRole(pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner'),style:{backgroundColor:'#3a2f12',borderRadius:8,padding:6},children:(0,le.jsx)(C.T,{size:12,colour:O.colours.gold,children:'staff'===ae?`Staff app preview: what staff see in the Staff app. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`:`Previewing the ${L.ROLE_LABEL[ae].toLowerCase()} view. Tap to return to ${L.ROLE_LABEL[pe?.ownerAccess?'owner':pe?.managerAccess?'manager':pe?.role??'owner']}.`})}):null]}),(0,le.jsx)(D.AssistantRequestsButton,{go:Be,testID:"assistant-requests-top"}),(0,le.jsxs)(y.default,{ref:Ie,...Ee.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:900,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'!==we||Se?null:(0,le.jsx)(l.AlertsBanner,{}),'home'!==we||Se?null:(0,le.jsx)(a.WhosOnShift,{}),(0,le.jsx)(f.BackTitleRow,{back:!('home'===we&&!Se||Ne),onBack:Pe,title:$e?$e.title:'bookings'===we&&'waitlist'===Se?'Waitlist':'staff'===ae&&'home'===we?'Staff app preview':he[we]}),'home'===we&&pe&&'staff'===pe.role&&'owner'===H.APP_VARIANT?(0,le.jsxs)(k.default,{testID:"access-off-banner",style:{borderWidth:1,borderColor:O.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",colour:O.colours.gold,children:"Your manager access is off"}),(0,le.jsx)(C.Muted,{children:"Your own shifts, clock in, rota, pay and tips are still here."}),(0,le.jsx)(C.Button,{label:"Clock in and my shifts",onPress:()=>Be('more','clock')})]}):null,'home'===we?'staff'===ae?(0,le.jsx)(F.StaffHome,{go:Be}):(0,le.jsx)($.Dashboard,{go:Be,ownerHome:st}):null,'orders'===we?(0,le.jsx)(Y.Orders,{}):null,'bookings'===we?(0,le.jsx)(T.Bookings,{go:Be,only:'waitlist'===Se?'waitlist':void 0}):null,'forecast'===we?(0,le.jsx)(U.Forecasts,{go:Be}):null,'chat'===we?(0,le.jsx)(Q.Chat,{go:Be}):null,'more'===we?$e?(0,le.jsx)($e.C,{go:Be}):(0,le.jsx)(K.MoreMenu,{go:Be}):null]}),(0,le.jsx)(p.SeatAllergenReminder,{rid:e}),'staff'!==ae?(0,le.jsx)(Z.PrintHost,{rid:e}):null,'staff'!==ae?(0,le.jsx)(X.AlertHost,{variant:"managers",rid:e,me:be,onOpen:e=>Be('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,le.jsx)(q.BottomTabs,{background:(0,s.soutersSurface)('#0d0d0d'),active:Xe,onPress:e=>'signoff'===e?Be('more','signoff'):'rota'===e?Be('more','rota'):'cashup'===e?Be('more','cashup'):Be(e),tabs:Qe.map(e=>({id:e.id,label:e.label,short:e.short,icon:e.icon,a11y:'rota'===e.id?'Rota, the staff rota':'signoff'===e.id?ge(Ye.days.length,Ye.requests):'cashup'===e.id?'Cash up':'more'===e.id&&Ke&&De?`More, ${De} new order${De>1?'s':''} in Orders`:'more'===e.id&&Ke&&Le?`More, ${Le} unread in Staff chat`:void 0,badge:'chat'===e.id&&Le?{text:String(Le),bg:O.colours.red}:'bookings'===e.id&&Ge?{text:String(Ge),bg:O.colours.amber,fg:'#0B0B0B',testID:'pending-badge'}:'orders'===e.id&&De?{text:String(De),bg:O.colours.red}:'signoff'===e.id&&Je?{text:String(Je),bg:O.colours.amber,fg:'#0B0B0B',testID:'signoff-badge'}:'more'===e.id&&Ke&&De?{text:String(De),bg:O.colours.red,testID:'more-orders-badge'}:'more'===e.id&&Ke&&Le?{text:String(Le),bg:O.colours.red,testID:'more-chat-badge'}:null}))}),(0,le.jsx)(j.default,{visible:Ae,transparent:!0,animationType:"fade",onRequestClose:()=>ke(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ke(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Your venues"}),Ze.filter(e=>!Re||'saltmarsh'!==e.id).map(t=>(0,le.jsx)(S.default,{accessibilityRole:"button",onPress:()=>{L.useOwner.getState().setSite(t.id),ke(!1),Be('home')},style:{padding:12,borderRadius:12,borderWidth:1,borderColor:t.id===e?O.colours.gold:O.colours.border},children:(0,le.jsxs)(C.Row,{style:{justifyContent:'space-between'},children:[(0,le.jsxs)(k.default,{children:[(0,le.jsx)(C.T,{weight:"medium",children:t.name}),(0,le.jsx)(C.Muted,{children:t.place})]}),t.id===e?(0,le.jsx)(C.Badge,{kind:"gold",label:"Current"}):null]})},t.id)),(0,le.jsx)(C.Muted,{children:t.IS_ISOLATED_VENUE?`This app belongs only to ${ne.name}.`:Re?'Switch venues without signing out. Other venues appear here once they are set up.':'Switch venues without signing out. The Venue is made up, for trying CoverCharge offline.'})]})})}),(0,le.jsx)(j.default,{visible:Ce,transparent:!0,animationType:"fade",onRequestClose:()=>ve(!1),children:(0,le.jsx)(S.default,{style:{flex:1,backgroundColor:'#000a',justifyContent:'flex-end'},onPress:()=>ve(!1),children:(0,le.jsxs)(k.default,{style:{backgroundColor:O.colours.surface,padding:16,gap:8,borderTopLeftRadius:16,borderTopRightRadius:16},children:[pe?(0,le.jsxs)(C.Row,{gap:10,children:[(0,le.jsx)(_.StaffAvatar,{id:pe.id,size:44}),(0,le.jsxs)(k.default,{style:{flex:1},children:[(0,le.jsxs)(C.T,{weight:"semibold",children:["Signed in as ",pe.name]}),(0,le.jsx)(C.Muted,{children:(0,N.levelJob)(pe.level??L.ROLE_LABEL[pe.role],pe.job)})]})]}):(0,le.jsxs)(k.default,{style:{gap:6},children:[(0,le.jsx)(C.T,{weight:"semibold",children:"Not signed in (preview)"}),(0,le.jsx)(C.Muted,{children:"Open your personal link, or paste it here, to sign in as yourself."}),(0,le.jsx)(P.SignInWithLink,{})]}),t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON||t.IS_GREENSIDE||!pe?null:(0,le.jsx)(C.Button,{kind:"secondary",label:"Open CoverCharge for Staff (as you)",onPress:()=>{(async()=>{const e=t.IS_WILDINGS?await(0,o.wildingsStaffAppUrl)():t.IS_KIRKMICHAEL?await(0,o.kirkmichaelStaffAppUrl)():(0,N.appUrl)('staff');e&&window.location.assign(e)})()}}),(0,le.jsx)(C.Muted,{children:"Preview what each role sees:"}),['owner','manager','staff'].filter(e=>!pe||(0,B.clampRole)(e,pe.ownerAccess?'owner':pe.managerAccess?'manager':pe.role)===e).map(e=>(0,le.jsx)(C.Button,{kind:e===ae?'primary':'secondary',label:'staff'===e?'Staff app preview':`${L.ROLE_LABEL[e]} view`,onPress:()=>{L.useOwner.getState().setPreviewRole(e),ve(!1)}},e))]})})}),(0,le.jsx)(W.OnboardingHost,{go:Be}),(0,le.jsx)(V.CoachHost,{})]})}},1419,[805,813,899,1193,1228,1210,1028,1025,891,1026,880,1032,1087,17,356,378,385,278,409,85,19,777,857,858,876,804,1420,1184,1057,884,1428,920,219,1433,1473,839,856,1475,1482,1483,1484,1190,1246,1485,1459,1486,1488,1457,1161,1230,1395,1232,1245,1490,1084,1086,1556,1557,1576,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1420,[805,1421,1095,1270,1422,812,822,1117,1118,1091,1122,1423,1114,1119,1408,1409,1057,1344,996,1120,1089,841,1387,1125,1425,1241,1426,1400,1078,1055,1090,17,85,777,1364,858,845,851,863,1322,804,1184,1098,1115,998,1361,1062,1162,1427,1232,899,1186,1405,862,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1421,[]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1422,[806,17,85,777,899,1274,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1423,[17,385,85,1424,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1424,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1425,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1187,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1426,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1427,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1428,[1429,17,219,24,85,856,1430,920,804,1432,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1429,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1430,[17,278,85,777,857,804,1431,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1431,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1432,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Dashboard=function({go:e,ownerHome:n=!1}){const{rid:a,r:x,now:H,role:ae,me:ie,today:re}=(0,A.useCtx)(5e3),de=(0,p.useOrders)(a),ce=(0,p.useBookings)(a),ue=(0,p.useWaitlist)(a),ge=(0,p.useEvents)(a),xe=(0,p.useRatings)(a),me=(0,j.useOwner)(e=>e.staff),be=(0,j.useOwner)(e=>(0,j.liveAttendance)(e.attendance)),fe=(0,j.useOwner)(e=>e.shifts),pe=(0,S.useRealHistory)(a,H),je=(0,l.useMemo)(()=>(0,s.forecastToday)(x,ce,de,ge,H,pe??void 0),[x,ce,de,ge,pe,H.getTime()/6e4|0]),ke=(0,M.useExamples)(),we=(0,N.useCashUp)(e=>e.cashUps),$e=ce.filter(e=>e.date===re),Ie=de.filter(B.LIVE),ve=ue.filter(e=>'waiting'===e.status||'notified'===e.status),Ce=(0,C.seatedCoversOn)(ce,re),De=(0,oe.coversSplit)($e,re),Te=Ie.filter(e=>(0,U.chainNeedsAction)(e,ce)),Be=$e.filter(e=>['confirmed','seated'].includes(e.status)&&(0,U.bookingNeedsAction)(e,Ie)),Ae=Ie.flatMap(e=>(0,I.readinessFor)(e,x,H).map(t=>({...t,order:e}))).filter(e=>'due'===e.state||'overdue'===e.state),Le=je.nextHour,Se=(0,B.busyLevel)(Le?.coversHigh??0,je.busy.busy),Me=(0,B.restOfDayLevel)(je,x),Ne=de.filter(e=>e.paid>0&&!!e.createdAt&&(0,v.ymd)(new Date(e.createdAt))===re).reduce((e,t)=>e+t.paid,0),Pe=(0,R.tradingDay)(H),He=ke?(0,L.revenueHistory)(x,H,7).filter(e=>e.date.getDay()===H.getDay()).pop():void 0,Fe=ke?{today:186e3+Ne,last:He?{date:(0,v.ymd)(He.date),pence:He.total}:null,online:0,show:!0}:(0,O.takingsToday)(we,a,Pe,Ne),We=j.CAN.takings(ae)&&(!(0,W.isLive)()||(0,W.can)('takings.view')),Re=(0,l.useMemo)(()=>(0,L.insights)(x,ce,de,ge,xe,H,Ce),[x.id,ce.length,xe.length,Ce]),Oe=((0,A.weekday)(H),(0,k.openWorkingRows)(be,re)),ze=(0,ee.useFrontDoor)(re),Ee=(0,u.useBookingWrite)(),Ge=(0,w.useOutstanding)(),Ue=(0,i.useTravelDay)('owner',re),qe=(0,A.useSignedIn)(),Ye=(0,A.useInStaffApp)(),Ke=(0,P.canSeeMonthTakings)(ae,qe,{inStaffApp:Ye,live:(0,W.isLive)()}),Ve=(0,F.homeSetupNagsHidden)(a),Qe=(0,j.useOwner)(e=>e.socialPosts.reduce((e,t)=>e+('awaiting approval'===t.status?1:0),0)),[Xe,Ze]=(0,l.useState)(!1),[Je,et]=(0,l.useState)(!1),[tt,st]=(0,l.useState)(!1),ot=ie.replace(' (example)',''),lt=j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-restaurant-dashboard",label:"Restaurant dashboard",accessibilityLabel:"Restaurant dashboard, everything on the Display: any day, table plan, Timeline, guests, Covers and actions",onPress:()=>e('more','serviceboard'),style:{minHeight:56}}):null;return Ue?(0,ne.jsxs)(b.default,{style:{gap:12},children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(i.DayView,{rid:a,day:Ue,today:re,app:"owner"})]}):(0,ne.jsxs)(b.default,{style:{gap:12},testID:n?'owner-home':'managers-home',children:[lt,(0,ne.jsx)(i.DayBar,{app:"owner",today:re}),(0,ne.jsx)(K.WhoBar,{}),qe&&'owner'!==qe.role?(0,ne.jsx)(Q.MyShiftCard,{go:e}):null,qe?(0,ne.jsx)(X.MyTasksToday,{rid:a,staffId:qe.id,name:qe.name,onShift:(0,J.shiftNow)(qe.id,Date.now()).on}):null,'staff'!==ae?(0,ne.jsx)(Z.TodaysTipsCard,{rid:a,today:re}):null,'staff'!==ae?(0,ne.jsx)(Z.TipsPotCard,{rid:a,today:re}):null,j.CAN.manage(ae)?(0,ne.jsx)(b.default,{testID:"home-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-insights-toggle",kind:tt?'secondary':'primary',label:tt?'Hide insights':'Insights',accessibilityLabel:tt?'Hide insights':'Insights: business insights, stats and suggestions. Closed until you tap.',onPress:()=>st(e=>!e),style:{minHeight:56,width:'100%'}})}):null,j.CAN.manage(ae)&&tt?(0,ne.jsxs)(b.default,{testID:"home-insights-panel",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,ne.jsx)(b.default,{testID:"home-business-insights-wrap",style:{alignItems:'center',width:'100%'},children:(0,ne.jsx)(f.Button,{testID:"home-business-insights",label:"Business insights",accessibilityLabel:"Business insights, stats and percentages from your bookings and cash ups",onPress:()=>e('more','bizinsights'),style:{minHeight:56,width:'100%'}})}),(0,ne.jsx)(le.SuperProInsights,{go:e}),(0,ne.jsxs)(b.default,{testID:"home-insights-feed",style:{gap:12,width:'100%'},children:[(0,ne.jsx)(B.SectionHead,{title:"Insights",sub:ke?'AI-style suggestions from your bookings, orders, stock and calendar (example figures)':'From your own bookings, reviews and calendar'}),Re.slice(0,4).map((t,s)=>(0,ne.jsx)(E.FadeIn,{delay:100+90*s,children:(0,ne.jsxs)(f.Card,{style:{borderLeftWidth:4,borderLeftColor:{gold:T.colours.gold,red:T.colours.red,amber:T.colours.amber,ok:T.colours.ok,blue:T.colours.blue}[t.tone]},children:[(0,ne.jsxs)(f.T,{weight:"semibold",center:!0,children:[t.icon," ",t.title]}),(0,ne.jsx)(f.Muted,{center:!0,children:t.body}),t.action?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:`${t.action.label} \u2192`,onPress:()=>e(t.action.tab,t.action.sub??null),style:{alignSelf:'center'}}):null]})},t.id)),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"All insights",onPress:()=>e('more','insights'),style:{alignSelf:'center'}})]})]}):null,(0,ne.jsx)(ye,{split:De}),(0,ne.jsx)(te.BlocksBanner,{rid:a,now:H,by:ie}),(0,ne.jsx)(y.KitchenSignoffs,{rid:a,today:re,by:ie,app:"owner",canConfirm:j.CAN.manage(ae)}),j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(q.SetupCard,{go:e}):null,j.CAN.manage(ae)&&!Ve?(0,ne.jsx)(o.SeasonsTodo,{go:e}):null,(0,ne.jsx)(r.LastFoodBanner,{rid:a,now:H}),(0,ne.jsx)(d.NextTableFreeCard,{rid:a,now:H}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{testID:"home-blocks",label:"Block bookings",accessibilityLabel:"Block bookings: block now, add a block, see future blocks",accessibilityHint:Ee.hint,disabled:!Ee.ok,onPress:()=>e('more','blocks')}):null,(0,ne.jsx)(f.Button,{testID:"home-add-soldout",label:"Add sold out",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ze(!0),style:{minHeight:56}}),(0,ne.jsxs)(b.default,{testID:"front-door-bar",dataSet:{centre:'buttons'},style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center'},children:[(0,ne.jsx)(c.QuietButton,{label:"New booking",onPress:ze.openBooking,testID:"home-booking",disabled:!Ee.ok,accessibilityHint:Ee.hint}),j.CAN.manage(ae)?(0,ne.jsx)(te.CloseGardenButton,{quiet:!0,short:!0,rid:a,r:x,now:H,by:ie}):null]}),ze.elements,j.CAN.manage(ae)?(0,ne.jsx)(Y.PaydaysCard,{go:e}):null,(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsxs)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center'},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Next hour",Le?` \xb7 ${(0,A.fmtH)(Le.hour)}\u2013${(0,A.fmtH)(Le.hour+1)}`:'']}),je.example?(0,ne.jsx)(S.ExampleBadge,{}):je.enough?(0,ne.jsx)(f.Badge,{kind:"amber",label:"ESTIMATE"}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:"BOOKED ONLY"}),(0,ne.jsx)(E.Gauge,{pct:Le?Se.pct:0,label:Le?Se.label:je.open?'Kitchen closing':'Closed today',sub:Le&&!je.enough?`${Le.booked} booked${Le.walkIns?` + ${Le.walkIns} walk-ins seated`:''} \xb7 not enough history for a forecast yet`:Le?`Estimated ${(0,s.coversRange)(Le.coversLow,Le.coversHigh)} \xb7 Busy at ${je.busy.busy} Covers an hour \xb7 ${Le.booked} booked + about ${Le.walkIns} walk-ins${(0,h.showTakeaway)(x)?` \xb7 about ${Le.takeaway} takeaway`:''}`:'No forecast for the next hour'}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[je.enough?(0,ne.jsx)(f.Badge,{kind:"gold",label:`Rest of today: ${Me.level.label}${Me.peak?`, peak ${(0,A.fmtH)(Me.peak.hour)}`:''}`}):null,je.enough?(0,ne.jsx)(f.Badge,{kind:"neutral",label:`${(0,s.coversRange)(je.restOfDay.low,je.restOfDay.high)}${(0,h.showTakeaway)(x)?` \xb7 about ${je.restOfDay.takeaway} takeaways`:''}`}):(0,ne.jsx)(f.Badge,{kind:"neutral",label:`Booked so far: ${je.restOfDay.booked} Covers`})]}),je.flags.length?(0,ne.jsxs)(f.Muted,{center:!0,children:["Calendar: ",je.flags.join(', ')]}):null,j.CAN.forecasts(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Open forecasts \u2192",onPress:()=>e('forecast')}):null]})}),(0,ne.jsxs)(f.Row,{wrap:!0,gap:10,children:[(0,h.showTakeaway)(x)||Ie.length?(0,ne.jsx)(E.FadeIn,{delay:200,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Live orders",value:"",accent:Ie.some(e=>'new'===e.status)?T.colours.red:void 0,onPress:()=>e('orders'),sub:(0,D.orderAtTableOn)(x)?`${Ie.filter(e=>'takeaway'===e.type).length} takeaway \xb7 ${Ie.filter(e=>'table'===e.type).length} table`:`${Ie.filter(e=>'takeaway'===e.type).length} takeaway`,children:(0,ne.jsx)(E.CountUp,{value:Ie.length})})}):null,ve.length>0?(0,ne.jsx)(E.FadeIn,{delay:260,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Waitlist",value:"",onPress:()=>e('bookings','waitlist'),sub:`${ve.reduce((e,t)=>e+t.partySize,0)} Covers waiting`,children:(0,ne.jsx)(E.CountUp,{value:ve.length})})}):null,We&&Fe.show?(0,ne.jsx)(E.FadeIn,{delay:320,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(z.TakingsTodayCard,{t:Fe,example:ke,onPress:()=>e('more','analytics')})}):null,(0,ne.jsx)(E.FadeIn,{delay:380,style:{flexGrow:1,flexBasis:150},children:(0,ne.jsx)(B.Tile,{label:"Allergy alerts",value:"",accent:Te.length+Be.length?T.colours.red:T.colours.ok,sub:"Need a sign-off",children:(0,ne.jsx)(E.CountUp,{value:Te.length+Be.length,colour:Te.length+Be.length?T.colours.red:T.colours.ok})})})]}),Te.length+Be.length+Ae.length?(0,ne.jsx)(B.SectionHead,{title:"Needs action now"}):null,Te.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 ${e.ref} ${'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'takeaway'}`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.AllergyChain,{o:e,me:ie,compact:!0})]},e.id)),Be.map(e=>(0,ne.jsxs)(B.AlertBox,{colour:T.colours.red,title:`ALLERGY \xb7 booking ${e.time} ${e.name} (${e.partySize})`,children:[(0,ne.jsx)(f.T,{size:14,children:e.allergies.map(e=>`${(0,$.allergenLabel)(e.allergen)} (${(0,$.severityLabel)(e.severity)})`).join('; ')}),(0,ne.jsx)(_.BookingAllergyChain,{b:e,me:ie})]},e.id)),Ae.map(t=>(0,ne.jsxs)(B.AlertBox,{colour:'overdue'===t.state?T.colours.red:T.colours.amber,title:`${'cook'===t.stage?'START COOKING':'bag'===t.stage?'BAG IT':'READY'} \xb7 ${t.order.ref} pickup ${(0,v.hm)(new Date(t.order.slotTime))}${'overdue'===t.state?' \xb7 OVERDUE':''}`,children:[(0,ne.jsx)(f.T,{size:14,children:t.detail}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Open orders",onPress:()=>e('orders')})]},t.id)),j.CAN.manage(ae)&&(Ge.days.length||Ge.requests)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`HOURS \xb7 ${Ge.days.length?`${Ge.days.length} earlier day${Ge.days.length>1?'s':''} to sign off`:''}${Ge.days.length&&Ge.requests?' \xb7 ':''}${Ge.requests?`${Ge.requests} correction request${Ge.requests>1?'s':''}`:''}`,children:[(0,ne.jsx)(f.T,{size:14,children:"Hours only count for pay once a manager confirms them."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Sign off hours",testID:"nudge-signoff",onPress:()=>e('more','signoff')})]}):null,Qe&&j.CAN.publishSocial(ae)?(0,ne.jsxs)(B.AlertBox,{colour:T.colours.amber,title:`SOCIAL \xb7 ${Qe} post${Qe>1?'s':''} awaiting approval`,children:[(0,ne.jsx)(f.T,{size:14,children:"Drafted by staff. Review and approve before anything goes out. Posting: not set up yet."}),(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Review posts",onPress:()=>e('more','social')})]}):null,(0,ne.jsx)(B.SectionHead,{title:"Quick actions"}),(0,ne.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:"Post to social",onPress:()=>e('more','social'),style:({pressed:e})=>({borderRadius:16,borderWidth:1.5,borderColor:T.colours.gold,backgroundColor:e?T.colours.goldTint:T.colours.surface,padding:12,flexDirection:'row',alignItems:'center',gap:10}),children:[(0,ne.jsxs)(f.Row,{gap:4,children:[(0,ne.jsx)(G.Mark,{p:"facebook"}),(0,ne.jsx)(G.Mark,{p:"instagram"}),(0,ne.jsx)(G.Mark,{p:"tiktok"}),(0,ne.jsx)(G.Mark,{p:"youtube"})]}),(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"bold",children:"Post to social"}),(0,ne.jsx)(f.Muted,{children:"Facebook + Instagram, TikTok + YouTube: not set up yet"})]}),(0,ne.jsx)(f.T,{colour:T.colours.gold,size:20,children:"\u203a"})]}),(0,ne.jsx)(G.QuickLinksSection,{go:e,heading:e=>(0,ne.jsx)(B.SectionHead,{title:e})}),(0,ne.jsx)(B.SectionHead,{title:"Who\u2019s on now",right:(0,ne.jsx)(f.Badge,{kind:"ok",label:`${Oe.length} clocked in`})}),(0,ne.jsxs)(f.Card,{children:[0===Oe.length?(0,ne.jsx)(f.Muted,{children:"Nobody clocked in yet."}):null,Oe.map(e=>{const t=me.find(t=>t.id===e.staffId),s=(0,j.shiftOf)(fe,e.staffId,re),o=new Date(e.in),l=!!s&&o.getHours()+o.getMinutes()/60-s.start>.08333333333333333;return(0,ne.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(b.default,{style:{flex:1},children:[(0,ne.jsx)(f.T,{weight:"semibold",children:t?.name??e.staffId}),(0,ne.jsxs)(f.Muted,{children:[t?.job," \xb7 in ",(0,v.hm)(o),s?` \xb7 shift ${(0,A.fmtH)(s.start)}\u2013${(0,A.fmtH)(s.end)}`:' \xb7 unscheduled']})]}),l?(0,ne.jsx)(f.Badge,{kind:"amber",label:"Late"}):(0,ne.jsx)(f.Badge,{kind:"ok",label:"On site"})]},e.id)}),j.CAN.manage(ae)?(0,ne.jsx)(f.Button,{small:!0,kind:"ghost",label:"Rota & timesheets \u2192",onPress:()=>e('more','rota')}):(0,ne.jsx)(f.Button,{small:!0,kind:"secondary",label:"Clock in / out",onPress:()=>e('more','clock')})]}),Ke?(0,ne.jsx)(f.Button,{testID:"home-takings-button",kind:Je?'secondary':'primary',label:Je?'Hide takings':'Takings',accessibilityLabel:Je?'Hide takings':'Takings: this month by day, from confirmed cash ups',onPress:()=>et(e=>!e),style:{minHeight:56}}):null,Ke&&Je?(0,ne.jsx)(E.FadeIn,{children:(0,ne.jsx)(he,{rid:a,today:re})}):null,'owner'!==ae||V.IS_CAR?null:(0,ne.jsx)(f.Button,{testID:"home-customer-support",label:"Customer support",accessibilityLabel:"Customer support, send a message or a picture to CoverCharge",onPress:()=>e('more','support'),style:{minHeight:56,width:'100%'}}),(0,ne.jsx)(se.SoldOutSheet,{visible:Xe,onClose:()=>Ze(!1),rid:a,by:ot,hideLinks:!0,testID:"home-soldout-sheet"})]})},_e.monthAxisDays=ue,_e.MonthTakingsCard=he,_e.WalkInSplitCard=ye;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=e(n),i=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=e(_r(_d[12])),m=e(_r(_d[13])),b=e(_r(_d[14])),f=_r(_d[15]),p=_r(_d[16]),j=_r(_d[17]),k=_r(_d[18]),w=_r(_d[19]),$=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),C=_r(_d[23]),D=_r(_d[24]),T=_r(_d[25]),B=_r(_d[26]),A=_r(_d[27]),L=_r(_d[28]),S=_r(_d[29]),M=_r(_d[30]),N=_r(_d[31]),P=_r(_d[32]),H=_r(_d[33]),F=_r(_d[34]),W=_r(_d[35]),R=_r(_d[36]),O=_r(_d[37]),z=_r(_d[38]),E=_r(_d[39]),G=_r(_d[40]),_=_r(_d[41]),U=_r(_d[42]),q=_r(_d[43]),Y=_r(_d[44]),K=_r(_d[45]),V=_r(_d[46]),Q=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),J=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),oe=_r(_d[54]),le=_r(_d[55]),ne=_r(_d[56]);const ae=18,ie=18,re=150,de=34;function ce(e){if(!e.length)return'';if(1===e.length)return`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;const t=e.length,s=[],o=[];for(let o=0;o9){const a=3/Math.sqrt(n);o[e]=a*t*s[e],o[e+1]=a*l*s[e]}}let l=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let s=0;sae+(t-1)/Math.max(1,e-1)*s,l=[1,5,10,15,20,25].filter(t=>t=36)&&n.push(e);for(;n.length&&o(e)-o(n[n.length-1])<36;)n.pop();return[...n,e]}function he({rid:e,today:t}){const s=(0,N.useCashUp)(e=>e.cashUps),[o,i]=(0,l.useState)(t.slice(0,7)),[r,d]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),h=(0,l.useMemo)(()=>(0,P.monthTakings)(s,e,o,t),[s,e,o,t]),y=(0,l.useMemo)(()=>(0,P.firstTakingsMonth)(s,e),[s,e]),p=!!y&&yae+(e-1)/Math.max(1,k-1)*w,C=e=>$-e/I*128,D=[];h.days.forEach((e,t)=>{if('recorded'!==e.state)return;const s={x:v(e.day),y:C(e.value)};t&&'recorded'===h.days[t-1].state?D[D.length-1].push(s):D.push([s])});const B=h.days.filter(e=>'future'!==e.state),A=[...h.days].reverse().find(e=>'recorded'===e.state),L=h.days.find(e=>e.date===c&&'future'!==e.state)??(h.current?h.days.find(e=>e.date===t):void 0)??A??B[B.length-1],S=e=>{const t=B.findIndex(e=>e.date===L?.date),s=B[Math.max(0,Math.min(B.length-1,t+e))];s&&(u(s.date),x.default.announceForAccessibility?.(M(s)))},M=e=>`${(0,P.longDay)(e.date)}, ${'recorded'===e.state?(0,P.poundsWhole)(e.value):'pending'===e.state?'not cashed up yet':'no cash up'}`,F=h.current?`so far in ${h.month}`:`in ${h.month} ${o.slice(0,4)}`,W=null==h.vsPct?null:`vs ${h.current?'same point last month':(0,P.monthName)((0,P.addMonths)(o,-1))} ${h.vsPct>0?'+':''}${h.vsPct}%`,R=h.recorded?`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. ${(0,P.poundsWhole)(h.total)} ${F}, from ${h.recorded} cash up${1===h.recorded?'':'s'}. Best day ${(0,P.longDay)(h.best.date)}, ${(0,P.poundsWhole)(h.best.value)}.${W?` ${W.replace('+','up ').replace(/ -(\d)/,' down $1')}.`:''}`:`Takings ${h.current?'this month':`${h.month} ${o.slice(0,4)}`}. No cash-ups yet${h.current?' this month':''}.`,O=r?ue(k,r):[],z=(e,t,s,l,n)=>(0,ne.jsx)(m.default,{testID:n,accessibilityRole:"button",accessibilityLabel:t,accessibilityState:{disabled:!s},disabled:!s,onPress:()=>{i((0,P.addMonths)(o,l)),u(null)},style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:24,opacity:s?e?.6:1:.25}),children:(0,ne.jsx)(f.T,{size:24,colour:T.colours.gold,center:!0,children:e})});return(0,ne.jsx)(f.Card,{highlight:T.colours.gold,style:{alignItems:'center',gap:6},children:(0,ne.jsxs)(b.default,{testID:"home-month-takings",style:{width:'100%',alignItems:'center',gap:6,minWidth:0},children:[(0,ne.jsxs)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,accessibilityRole:"header",children:["Takings ",h.current?'this month':'by month']}),p||j?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:4,width:'100%'},children:[z('\u2039',`Previous month, ${(0,P.monthName)((0,P.addMonths)(o,-1))}`,p,-1,'mt-prev'),(0,ne.jsxs)(f.T,{center:!0,colour:T.colours.goldLight,style:{flexShrink:1},testID:"mt-month",children:[h.month," ",o.slice(0,4)]}),z('\u203a',`Next month, ${(0,P.monthName)((0,P.addMonths)(o,1))}`,j,1,'mt-next')]}):null,(0,ne.jsx)(b.default,{accessible:!0,accessibilityLabel:R,testID:"mt-summary",style:{alignItems:'center',width:'100%',gap:2},children:h.recorded?(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsx)(f.T,{size:38,weight:"bold",colour:T.colours.gold,center:!0,testID:"mt-total",children:(0,P.poundsWhole)(h.total)}),(0,ne.jsx)(f.T,{center:!0,colour:T.colours.goldLight,children:F}),(0,ne.jsxs)(f.Muted,{center:!0,testID:"mt-best",children:["Best day: ",(0,P.shortDay)(h.best.date)," \xb7 ",(0,P.poundsWhole)(h.best.value)]}),W?(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-vs",children:W}):null]}):(0,ne.jsx)(f.Muted,{center:!0,testID:"mt-empty",children:h.current?'No cash-ups yet this month.':`No cash-ups in ${h.month}.`})}),(0,ne.jsxs)(b.default,{style:{width:'100%',minWidth:0},children:[(0,ne.jsxs)(b.default,{testID:"mt-plot",onLayout:e=>d(e.nativeEvent.layout.width),style:{height:re,width:'100%',overflow:'visible'},children:[r?(0,ne.jsxs)(a.default,{width:r,height:re,accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:[(0,ne.jsx)(n.Defs,{children:(0,ne.jsxs)(n.LinearGradient,{id:"mtFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ne.jsx)(n.Stop,{offset:"0",stopColor:"#3A2F1E",stopOpacity:1}),(0,ne.jsx)(n.Stop,{offset:"1",stopColor:"#3A2F1E",stopOpacity:.35})]})}),(0,ne.jsx)(n.Line,{x1:ae,y1:$,x2:r-ie,y2:$,stroke:T.colours.hairline,strokeWidth:1}),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:`${ce(e)} L${e[e.length-1].x.toFixed(1)},142 L${e[0].x.toFixed(1)},142 Z`,fill:"url(#mtFill)",stroke:"none"},`a${t}`)),D.filter(e=>e.length>1).map((e,t)=>(0,ne.jsx)(n.Path,{d:ce(e),stroke:T.colours.gold,strokeWidth:2.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},`l${t}`)),D.filter(e=>1===e.length).map((e,t)=>(0,ne.jsx)(n.Circle,{cx:e[0].x,cy:e[0].y,r:3,fill:T.colours.gold},`s${t}`)),h.days.filter(e=>'missing'===e.state).map(e=>(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:$,r:2,fill:"none",stroke:T.colours.muted,strokeWidth:1},e.date)),L&&'recorded'===L.state?(0,ne.jsx)(n.Line,{x1:v(L.day),y1:10,x2:v(L.day),y2:$,stroke:T.colours.goldMuted,strokeWidth:1,strokeDasharray:"3,3"}):null,h.current?(()=>{const e=h.days.find(e=>e.date===t);return(0,ne.jsx)(n.Circle,{cx:v(e.day),cy:'recorded'===e.state?C(e.value):$,r:4.5,fill:T.colours.gold,stroke:T.colours.surface,strokeWidth:1.5})})():null,L&&'recorded'===L.state&&L.date!==t?(0,ne.jsx)(n.Circle,{cx:v(L.day),cy:C(L.value),r:5,fill:T.colours.surface,stroke:T.colours.gold,strokeWidth:2}):null]}):null,r?B.map(e=>(0,ne.jsx)(m.default,{testID:`mt-day-${e.day}`,accessibilityRole:"button",accessibilityLabel:M(e),accessibilityState:{selected:L?.date===e.date},onPress:()=>u(e.date),style:{position:'absolute',top:0,height:re,left:v(e.day)-w/Math.max(1,k-1)/2,width:w/Math.max(1,k-1)}},e.date)):null]}),(0,ne.jsx)(b.default,{testID:"mt-axis",style:{height:H.AXIS_BAND+6,minHeight:H.AXIS_BAND+6,width:'100%',position:'relative',overflow:'visible'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:O.map(e=>(0,ne.jsx)(f.T,{size:H.AXIS_FONT,colour:T.colours.muted,style:{position:'absolute',left:v(e)-17,width:de,top:0,textAlign:'center'},children:String(e)},e))})]}),L&&B.length?(0,ne.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'center',width:'100%',gap:4},children:[(0,ne.jsx)(m.default,{testID:"mt-day-prev",accessibilityRole:"button",accessibilityLabel:"Previous day",disabled:B[0]?.date===L.date,onPress:()=>S(-1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[0]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u2039"})}),(0,ne.jsxs)(b.default,{testID:"mt-readout",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:M(L),style:{flexShrink:1,minWidth:0,alignItems:'center',paddingVertical:4},children:[(0,ne.jsx)(f.Muted,{center:!0,children:L.date===t?`Today \xb7 ${(0,P.shortDay)(L.date)}`:(0,P.shortDay)(L.date)}),(0,ne.jsx)(f.T,{center:!0,size:20,weight:"semibold",colour:'recorded'===L.state?T.colours.goldLight:T.colours.muted,children:'recorded'===L.state?(0,P.poundsWhole)(L.value):'pending'===L.state?'Not cashed up yet':'No cash-up'})]}),(0,ne.jsx)(m.default,{testID:"mt-day-next",accessibilityRole:"button",accessibilityLabel:"Next day",disabled:B[B.length-1]?.date===L.date,onPress:()=>S(1),style:({pressed:e})=>({minWidth:48,minHeight:48,alignItems:'center',justifyContent:'center',opacity:B[B.length-1]?.date===L.date?.25:e?.6:1}),children:(0,ne.jsx)(f.T,{size:20,colour:T.colours.gold,center:!0,children:"\u203a"})})]}):null,(0,ne.jsx)(f.Muted,{center:!0,size:13,children:"From confirmed cash ups: card + cash \u2212 card tips. \u25cb = no cash up that day."})]})})}const ge='#3A2F1E';function ye({split:e}){return(0,ne.jsx)(f.Card,{style:{alignItems:'center',gap:8},children:(0,ne.jsxs)(b.default,{testID:"home-covers-split",accessible:!0,accessibilityLabel:`Walk-ins and bookings today. ${e.a11y}`,style:{width:'100%',alignItems:'center',gap:8},children:[(0,ne.jsx)(f.T,{weight:"semibold",colour:T.colours.gold,center:!0,children:"Walk-ins and bookings today"}),e.empty?(0,ne.jsx)(f.Muted,{center:!0,children:"No Covers yet"}):(0,ne.jsxs)(ne.Fragment,{children:[(0,ne.jsxs)(b.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:18,width:'100%'},children:[(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",colour:T.colours.gold,center:!0,testID:"split-walkin-pct",children:`${e.walkInPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.goldLight,center:!0,children:`Walk-ins \xb7 ${e.walkIns} Covers`})]}),(0,ne.jsxs)(b.default,{style:{alignItems:'center',minWidth:120},children:[(0,ne.jsx)(f.T,{size:26,weight:"bold",center:!0,testID:"split-booked-pct",children:`${e.bookingPct}%`}),(0,ne.jsx)(f.T,{size:14,colour:T.colours.muted,center:!0,children:`Booked \xb7 ${e.bookings} Covers`})]})]}),(0,ne.jsxs)(b.default,{style:{width:'100%',maxWidth:420,height:10,borderRadius:5,overflow:'hidden',flexDirection:'row',backgroundColor:ge,borderWidth:1,borderColor:T.colours.gold},children:[(0,ne.jsx)(b.default,{style:{width:`${e.walkInPct}%`,backgroundColor:T.colours.gold}}),(0,ne.jsx)(b.default,{style:{flex:1,backgroundColor:ge}})]})]})]})})}},1433,[843,1140,1434,17,780,1185,1074,1075,1426,1344,861,1078,264,385,85,777,858,876,1211,1193,845,1160,863,1055,866,804,1184,1057,1139,1145,1146,1008,839,1150,886,899,915,1444,1445,1149,1446,1162,853,1449,1188,1209,856,1207,1031,1032,1066,1098,1400,1153,1343,1467,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AdvancedSettings=function({go:e}){const{r:x,rid:P,today:O,me:$}=(0,D.useCtx)(6e4),V=$.replace(" (example)",""),J=x.settings,X=e=>v.useStore.getState().updateSettings(P,e),[ee,te]=(0,m.useState)(()=>(0,h.takeAdvancedPrefill)()),[oe,ae]=(0,m.useState)(null),ne=e=>{if(e.onReset)return e.onReset(),void ae(`${e.title}: back to the defaults.`);X(Object.fromEntries(e.reset.map(e=>[e,void 0]))),ae(`${e.title}: back to the defaults.`)},le=(0,M.useBookings)(P),re=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Ask about allergies first (in red)"}),(0,W.jsx)(j.Badge,{kind:"red",label:"ALWAYS ON"})]}),(0,W.jsx)(j.Muted,{size:13,children:"Food safety: every booking answers this before anything else, and staff tick \u201cAllergens seen\u201d."}),(0,W.jsx)(j.Toggle,{label:"Ask if they\u2019re bringing a dog",value:(0,T.dogQuestionOn)(x),onChange:e=>X({dogQuestion:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Most dogs per booking time"}),(0,W.jsx)(K,{label:"dogs per time",step:1,min:0,max:20,value:J.maxDogsPerSlot??0,unit:e=>e?`${e} dog${1===e?'':'s'}`:'No limit',onChange:e=>X({maxDogsPerSlot:e||void 0})})]}),(0,W.jsx)(j.Toggle,{label:"Ask about wheelchair or step-free access",value:(0,T.accessQuestionOn)(x),onChange:e=>X({accessQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Vegan and vegetarian ticks (optional for guests)",value:(0,T.dietQuestionOn)(x),onChange:e=>X({dietQuestion:e})}),(0,W.jsx)(j.Toggle,{label:"Let guests ask for a table (shown as \u2018not guaranteed\u2019)",value:!1!==J.tableRequests,onChange:e=>X({tableRequests:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Dog-friendly and step-free tables are marked on the table plan."}),e?(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Mark tables on the Table plan \u203a",onPress:()=>e('more','tableplan')}):null]}),ie=(0,T.dwellBands)(x),de=(e,s)=>X({dwellBands:ie.map((t,o)=>o===e?{...t,mins:s}:t)}),he=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"How long a table usually stays, by party size. Used for \u201cNext table free\u201d and for spacing bookings on a table."}),ie.map((e,s)=>{const t=(0,T.dwellFor)(x,9999===e.upTo?20:e.upTo,le);return(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{style:{flex:1},children:(0,T.bandLabel)(ie,s)}),(0,W.jsx)(K,{label:`table time for ${(0,T.bandLabel)(ie,s)}`,min:30,max:360,value:e.mins,unit:Q,onChange:e=>de(s,e)})]}),t.learned&&t.mins!==e.mins?(0,W.jsxs)(j.Muted,{size:12,children:["From your last ",t.samples," tables: about ",Q(t.mins)," (used for estimates)"]}):null]},s)}),(0,W.jsx)(j.Toggle,{label:"Fine-tune from how long tables really stay",value:!1!==J.dwellLearn,onChange:e=>X({dwellLearn:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Defaults: 90 min for 1\u20132 Covers, 105 min for 3\u20135, 2 hours for 6\u201319, 3 hours for 20 or more."})]}),ue=J.reservables??(0,S.reservablesOf)(x),ce=J.reservables??('anchorage'===P?ue:[]),pe=(e,s)=>X({reservables:ce.map(t=>t.id===e?{...t,...s}:t)}),ge=(0,W.jsxs)(y.default,{style:{gap:8},children:[ce.length?ce.map(e=>(0,W.jsxs)(y.default,{style:{gap:4},children:[(0,W.jsx)(j.Toggle,{label:`${e.name} can be reserved`,value:e.active,onChange:s=>pe(e.id,{active:s})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Price"}),(0,W.jsx)(K,{label:`${e.name} price`,min:5,max:1e3,value:Math.round(e.price/100),unit:e=>`\xa3${e}`,onChange:s=>pe(e.id,{price:100*s})})]}),(0,W.jsx)(j.Toggle,{label:`${e.name}: no deposit, paid on the night`,value:!!e.payOnNight,onChange:s=>pe(e.id,{payOnNight:s})}),e.payOnNight?null:(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.Muted,{children:"Pre-order deposit each"}),(0,W.jsx)(K,{label:`${e.name} pre-order deposit`,min:0,max:200,value:Math.round((e.depositPence??0)/100),unit:e=>e?`\xa3${e}`:'None',onChange:s=>pe(e.id,{depositPence:100*s||void 0})})]}),(0,W.jsx)(j.Muted,{size:12,children:e.uses.length?`Uses: ${e.uses.map(e=>`${e.qty} ${e.key}`).join(' + ')} from the counted stock. Held from the Display count and shown as \u201cReserved\u201d.`:'Not taken from the counted stock.'})]},e.id)):(0,W.jsx)(j.Muted,{children:"No reservable dishes yet."}),(0,W.jsx)(j.Toggle,{label:"Guests can reserve a crab or lobster on its own",value:!1!==J.reserveStock,onChange:e=>X({reserveStock:e})}),(0,W.jsx)(j.Muted,{size:13,children:"The kitchen is told about each reservation and the Head Chef taps OK."})]}),be=(0,T.regularEventsOf)(x),[me,xe]=(0,m.useState)(null),fe=e=>X({regularEvents:e}),ye=me?me.name.trim()?me.time&&!H.test(me.time)?'Start time looks wrong (use 20:00).':me.lastFood&&!H.test(me.lastFood)?'Last food orders looks wrong (use 19:00).':'once'!==me.rule.kind||_.test(me.rule.date)?'':'Date looks wrong (use 2026-12-31).':'Give it a name.':'',je=(0,W.jsxs)(y.default,{style:{gap:8},children:[be.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.name}),e.busier?(0,W.jsx)(j.Badge,{kind:"gold",label:"BUSIER"}):null,e.active?null:(0,W.jsx)(j.Badge,{kind:"neutral",label:"OFF"})]}),(0,W.jsxs)(j.Muted,{children:[(0,T.ruleText)(e.rule),e.time?` \xb7 from ${e.time}`:'',e.lastFood?` \xb7 last food orders ${e.lastFood}`:'']}),e.active?(0,W.jsxs)(j.Muted,{size:12,children:["Next: ",(0,T.nextOccurrence)(e,O)??'\u2014']}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:`event-edit-${e.id}`,onPress:()=>xe({...e})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>fe(be.filter(s=>s.id!==e.id))})]})]},e.id)),me?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Name"}),(0,W.jsx)(q,{label:"Event name",width:220,value:me.name,onChange:e=>xe({...me,name:e}),placeholder:"Open Mic Night"})]}),(0,W.jsx)(j.Muted,{children:"Repeats"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:6,children:[(0,W.jsx)(j.Chip,{label:"Last \u2026 of the month",selected:'last'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'last',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"Every week",selected:'weekly'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'weekly',weekday:'weekday'in me.rule?me.rule.weekday:0}})}),(0,W.jsx)(j.Chip,{label:"One-off date",selected:'once'===me.rule.kind,onPress:()=>xe({...me,rule:{kind:'once',date:O}})})]}),'weekday'in me.rule?(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:Y.map(e=>(0,W.jsx)(j.Chip,{label:G[e],selected:me.rule.weekday===e,onPress:()=>xe({...me,rule:{...me.rule,weekday:e}})},e))}):(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Event date",width:130,value:(0,t.slashDay)(me.rule.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(me.rule.date));xe({...me,rule:{kind:'once',date:(0,t.dayFromSlash)(s)??s}})},placeholder:"31/12/2026"})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts (optional)"}),(0,W.jsx)(q,{label:"Start time",value:me.time??'',onChange:e=>xe({...me,time:e||void 0}),placeholder:"20:00",bad:!!me.time&&!H.test(me.time)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Last food orders (optional)"}),(0,W.jsx)(q,{label:"Last food orders",value:me.lastFood??'',onChange:e=>xe({...me,lastFood:e||void 0}),placeholder:"19:00",bad:!!me.lastFood&&!H.test(me.lastFood)})]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Notes"}),(0,W.jsx)(q,{label:"Notes",width:240,value:me.notes??'',onChange:e=>xe({...me,notes:e||void 0}),placeholder:"Live music from 8pm"})]}),(0,W.jsx)(j.Toggle,{label:"Expect busier (raises the forecast)",value:me.busier,onChange:e=>xe({...me,busier:e})}),(0,W.jsx)(j.Toggle,{label:"On",value:me.active,onChange:e=>xe({...me,active:e})}),ye?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:ye}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save event",disabled:!!ye,testID:"event-save",onPress:()=>{const e={...me,name:me.name.trim()};fe(be.some(s=>s.id===e.id)?be.map(s=>s.id===e.id?e:s):[...be,e]),xe(null),ae(`Saved ${e.name}.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>xe(null)})]})]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a regular event",testID:"event-add",onPress:()=>xe({id:`ev-${Date.now().toString(36)}`,name:'',rule:{kind:'last',weekday:0},busier:!0,active:!0})}),(0,W.jsx)(j.Muted,{size:13,children:"Events show in Forecast key dates (with a Promote button), on the Today date bar, and lift the forecast when \u201cExpect busier\u201d is on."})]}),we=(0,C.hourSetsOf)(x),ke=(0,C.seasonOn)(x,new Date),[ve,Ce]=(0,m.useState)(null),[Se,Te]=(0,m.useState)(null),Re=J.hourOverrides??[],De=ve?ve.start&&!U.test(ve.start)?'Start date looks wrong (use day and month as MM-DD, e.g. 04-01 for 1 April).':ve.hours&&Object.values(ve.hours).some(e=>e&&(!H.test(e[0])||!H.test(e[1])||e[0]>=e[1]))?'Check the times: use 12:00 and 19:00, and closing must be after opening.':'':'',Me=Object.values(J.lastFoodByDay??{}).some(e=>e&&!H.test(e)),Le=[];we.some(e=>!e.hours)&&Le.push(`${we.filter(e=>!e.hours).map(e=>e.name).join(' and ')} kitchen hours`);we.filter(e=>e.hours).length>=1&&we.length>1&&we.some(e=>!e.start)&&Le.push('the date each season starts');const Pe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Muted,{size:13,children:"Kitchen (food) hours, not bar hours. The closing time is last food orders. Dining bookings are only offered inside these hours."}),Le.length?(0,W.jsxs)(j.Banner,{kind:"warn",title:"To finish setting up",children:["Please add ",Le.join(' and '),". Until then the app uses ",ke?.name??'your weekly'," hours all year."]}):null,ke?(0,W.jsxs)(j.T,{colour:R.colours.goldLight,children:["In use today: ",ke.name]}):null,we.map(e=>(0,W.jsxs)(j.Card,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",children:e.name}),ke?.id===e.id?(0,W.jsx)(j.Badge,{kind:"gold",label:"IN USE"}):e.hours?null:(0,W.jsx)(j.Badge,{kind:"amber",label:"NOT SET"})]}),(0,W.jsx)(j.Muted,{children:e.start?`Starts every year on ${e.start}`:'Start date: not set yet'}),e.hours?(0,W.jsx)(j.Muted,{size:13,children:Y.map(s=>`${G[s]} ${e.hours[s]?`${e.hours[s][0]}\u2013${e.hours[s][1]}`:'closed'}`).join(' \xb7 ')}):(0,W.jsx)(j.Muted,{size:13,children:"No hours yet."}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.hours?'Edit':`Set ${e.name} hours`,testID:`season-edit-${e.id}`,onPress:()=>Ce({...e,hours:e.hours?{...e.hours}:{...we.find(e=>e.hours)?.hours??x.kitchenHours}})})]},e.id)),ve?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.T,{weight:"semibold",children:[ve.name," hours"]}),(0,W.jsxs)(j.Row,{gap:8,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Muted,{children:"Starts every year on (MM-DD)"}),(0,W.jsx)(q,{label:"Season start date",value:ve.start??'',onChange:e=>Ce({...ve,start:e||void 0}),placeholder:"04-01",bad:!!ve.start&&!U.test(ve.start)})]}),Y.map(e=>{const s=ve.hours?.[e]??null,t=s=>Ce({...ve,hours:{...ve.hours,[e]:s}});return(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.T,{style:{width:44},children:G[e]}),(0,W.jsx)(j.Chip,{label:s?'Open':'Closed',selected:!!s,onPress:()=>t(s?null:['12:00','19:00'])}),s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:`${T.DAYS[e]} opens`,value:s[0],width:74,onChange:e=>t([e,s[1]]),bad:!H.test(s[0])}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,value:s[1],width:74,onChange:e=>t([s[0],e]),bad:!H.test(s[1])||s[0]>=s[1]})]}):null]},e)}),De?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:De}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save hours",disabled:!!De,testID:"season-save",onPress:()=>{var e;e=we.map(e=>e.id===ve.id?ve:e),X({hourSets:e}),Ce(null),ae(`Saved ${ve.name} hours.`)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Ce(null)})]})]}):null,(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Special days"}),(0,W.jsx)(j.Muted,{size:13,children:"One-off changes, e.g. closed for a private party or open late on Hogmanay."}),Re.map(e=>(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsxs)(j.T,{style:{flex:1},children:[e.date,": ",e.hours?`${e.hours[0]}\u2013${e.hours[1]}`:'kitchen closed',e.note?` \xb7 ${e.note}`:'']}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>X({hourOverrides:Re.filter(s=>s.date!==e.date)})})]},e.date)),Se?(0,W.jsxs)(j.Card,{highlight:R.colours.gold,children:[(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Date (DD/MM/YYYY)"}),(0,W.jsx)(q,{label:"Special day date",width:130,value:(0,t.slashDay)(Se.date),onChange:e=>{const s=(0,t.slashDate)(e,(0,t.slashDay)(Se.date));Te({...Se,date:(0,t.dayFromSlash)(s)??s})},placeholder:"31/12/2026",bad:!_.test(Se.date)})]}),(0,W.jsxs)(j.Row,{gap:6,style:{flexWrap:'wrap'},children:[(0,W.jsx)(j.Chip,{label:Se.hours?'Open':'Closed',selected:!!Se.hours,onPress:()=>Te({...Se,hours:Se.hours?null:['12:00','19:00']})}),Se.hours?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{label:"Opens",width:74,value:Se.hours[0],onChange:e=>Te({...Se,hours:[e,Se.hours[1]]})}),(0,W.jsx)(j.Muted,{children:"to"}),(0,W.jsx)(q,{label:"Last food orders",width:74,value:Se.hours[1],onChange:e=>Te({...Se,hours:[Se.hours[0],e]})})]}):null]}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.Muted,{children:"Note"}),(0,W.jsx)(q,{label:"Note",width:220,value:Se.note??'',onChange:e=>Te({...Se,note:e||void 0}),placeholder:"Private party"})]}),(()=>{const e=_.test(Se.date)?Se.hours&&(!H.test(Se.hours[0])||!H.test(Se.hours[1])||Se.hours[0]>=Se.hours[1])?'Check the times.':'':'Date looks wrong (use 2026-12-31).';return(0,W.jsxs)(W.Fragment,{children:[e?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:e}):null,(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Button,{small:!0,label:"Save special day",disabled:!!e,onPress:()=>{X({hourOverrides:[...Re.filter(e=>e.date!==Se.date),Se].sort((e,s)=>e.date.localeCompare(s.date))}),Te(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>Te(null)})]})]})})()]}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a special day",testID:"override-add",onPress:()=>Te({date:O,hours:null})}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Earlier last food orders (optional)"}),(0,W.jsx)(j.Muted,{size:13,children:"Leave blank to use the kitchen closing time. Regular events can set their own (Open Mic Night: 7pm)."}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:Y.map(e=>(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.Muted,{size:12,children:G[e]}),(0,W.jsx)(q,{label:`${T.DAYS[e]} last food orders`,width:74,value:J.lastFoodByDay?.[e]??'',placeholder:"\u2014",bad:!!J.lastFoodByDay?.[e]&&!H.test(J.lastFoodByDay[e]),onChange:s=>X({lastFoodByDay:{...J.lastFoodByDay??{},[e]:s||void 0}})})]},e))}),Me?(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"Use times like 19:00 (blank = kitchen close)."}):null,(0,W.jsx)(j.Muted,{children:"After last food orders, booking times are\u2026"}),(0,W.jsxs)(j.Row,{gap:6,children:[(0,W.jsx)(j.Chip,{label:"Offered for drinks only",selected:'drinks'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'drinks'})}),(0,W.jsx)(j.Chip,{label:"Not offered",selected:'block'===(0,T.afterLastFood)(x),onPress:()=>X({afterLastFood:'block'})})]})]}),Oe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"COVERS counter on Today (done / to come / total)",value:(0,T.coversCounterOn)(x),onChange:e=>X({coversCounter:e})}),(0,W.jsx)(j.Toggle,{label:"\u2018Next table free\u2019 when you\u2019re full",value:(0,T.nextTableOn)(x),onChange:e=>X({nextTableFree:e})}),(0,W.jsx)(j.Toggle,{label:"Show takeaway on home screens",value:(0,T.showTakeaway)(x),onChange:e=>X({showTakeaway:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Takeaway order alerts always work. With this off, takeaway figures sit in a collapsed Takeaway section."}),(0,W.jsx)(j.Muted,{size:13,children:"The flap click sound is set on each Display (Display settings), off by default."})]}),$e=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{label:"Show full gov.uk names, e.g. \u2018(substitute day)\u2019",value:!!J.holidayFullNames,onChange:e=>X({holidayFullNames:e})}),(0,W.jsx)(j.Muted,{size:13,children:"Off: \u201cChristmas Day\u201d shows on its date without \u201c(substitute day)\u201d."})]}),[Ie,ze]=(0,m.useState)(null),Ae=Ie??J.whatsapp??'',Be=!Ae.trim()||!!(0,L.waNumber)(Ae),Fe=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.T,{children:"The venue\u2019s WhatsApp number"}),(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(q,{label:"Venue WhatsApp number",testID:"adv-whatsapp-number",width:220,value:Ae,placeholder:"e.g. 01292 500123 or +44 7\u2026",bad:!Be,onChange:e=>{ze(e),e.trim()?(0,L.waNumber)(e)&&X({whatsapp:e.trim()}):X({whatsapp:void 0})}}),Ae.trim()&&Be?(0,W.jsx)(j.Badge,{kind:"gold",label:`wa.me/${(0,L.waNumber)(Ae)}`}):null]}),Be?null:(0,W.jsx)(j.T,{size:13,colour:R.colours.red,children:"That doesn\u2019t look like a phone number. Use the full number, e.g. 01292 500123 or +44 7700 900123."}),(0,W.jsx)(j.Muted,{size:13,children:"With a number here, guests see \u201cMessage us on WhatsApp\u201d on their booking confirmation, and staff and managers see \u201cWhatsApp guest\u201d on bookings that have a mobile number. Blank: all WhatsApp buttons stay hidden."}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: nothing is ever sent for you. The button opens WhatsApp with a message typed in, and the person taps Send themselves."})]}),Ee=(0,N.soldOutSettingsOf)(J.soldOut),Ne=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-soldout-auto",label:"Mark dishes sold out from the counts",value:Ee.auto,onChange:e=>X({soldOut:{...Ee,auto:e}}),a11y:"Mark dishes sold out from the live counts"}),(0,W.jsx)(j.Muted,{size:13,children:Ee.auto?'On: when a count (lobster, crab\u2026) runs out or drops below what a dish needs, every dish that uses it is marked sold out, with the reason, e.g. \u201cDeluxe Seafood Platter (no lobster)\u201d. It goes back on when the count is back up. Dishes marked by hand are left alone. Change which dishes use what in any Sold out list.':'Off: dishes are only marked sold out by hand. Dishes marked from the counts go back on.'}),(0,W.jsx)(j.T,{children:"Clear sold out dishes by themselves"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['close','morning','manual'].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-soldout-${e}`,label:N.SOLD_OUT_CLEAR_LABEL[e],selected:Ee.clear===e,onPress:()=>X({soldOut:{...Ee,clear:e}})},e))}),'manual'!==Ee.clear?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j.T,{children:"Next morning means"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:['04:00','05:00','06:00','08:00'].map(e=>(0,W.jsx)(j.Chip,{label:e,selected:Ee.morningAt===e,onPress:()=>X({soldOut:{...Ee,morningAt:e}})},e))})]}):null,(0,W.jsx)(j.Muted,{size:13,children:'close'===Ee.clear?'Dishes go back on at the kitchen\u2019s closing time that day (from Kitchen hours). Marked after closing: the next morning.':'morning'===Ee.clear?`Dishes go back on at ${Ee.morningAt} the next morning.`:'Dishes stay sold out until someone taps Back on.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: Sold out is a reminder for staff. It shows on the Display\u2019s slim strip and in every staff app\u2019s Sold out list. CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till."})]}),We=(0,s.venueBusy)(x,le,new Date),He=(0,E.clampWeeks)(J.forecastMinWeeks),Ue=(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsxs)(y.default,{testID:"busy-level-setting",style:{alignItems:'center',gap:12},accessible:!0,accessibilityLabel:We.words,children:[(0,W.jsx)(j.T,{center:!0,size:20,weight:"semibold",children:We.words}),(0,W.jsx)(j.Stepper,{testID:"busy-covers-hour",label:"Busy level in Covers an hour",value:J.busyCoversPerHour??30,min:1,max:200,onChange:e=>X({busyCoversPerHour:e,busyLearning:!1})}),(0,W.jsx)(j.Muted,{children:"Learning starts from your chosen level; enabling it starts a fresh history period, so older trading patterns do not immediately replace your choice."}),(0,W.jsx)(j.Toggle,{label:"Learn the busy level from our real history",value:!1!==J.busyLearning,onChange:e=>X({busyLearning:e,busyLearningSince:(new Date).toISOString().slice(0,10)})}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Steady starts at half the busy level. Busy starts at the busy level. Hourly forecasts use the upper end of their range."}),(0,W.jsx)(j.T,{center:!0,size:16,children:"Learning needs at least 4 weeks, 16 trading days and 40 recorded hours. It uses the 85th percentile of recorded hourly arrivals over the last 8 weeks, including walk-ins, excluding cancellations and no-shows. Changing the number keeps your override until learning is switched on again."}),We.enough?null:(0,W.jsx)(j.T,{center:!0,size:16,children:"Not enough real hourly history to learn yet. Using the starting or owner-set level."})]}),(0,W.jsx)(j.T,{children:"History needed before forecasts show"}),(0,W.jsx)(j.Row,{wrap:!0,gap:8,children:[1,2,3,4,6,8].map(e=>(0,W.jsx)(j.Chip,{testID:`adv-forecast-weeks-${e}`,label:1===e?'1 week':`${e} weeks`,selected:He===e,onPress:()=>X({forecastMinWeeks:e})},e))}),(0,W.jsx)(j.Muted,{size:13,children:`Forecasts, expected walk-ins and labour vs sales start once CoverCharge has ${1===He?'1 week':`${He} weeks`} of your bookings (and cash-ups for sales). Until then you see what is booked and your real labour cost, never invented figures.`}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: 2 weeks is a sensible start. More weeks give steadier forecasts but take longer to begin."}),(0,W.jsx)(l.ForecastDaySettings,{r:x,set:X})]}),Ye=(0,w.depositOf)(J),Ge=e=>X({deposit:{...Ye,...e}}),qe=o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsxs)(y.default,{style:{gap:8},children:[(0,W.jsx)(j.Toggle,{testID:"adv-deposit-on",label:"Ask bigger tables for a deposit",value:Ye.on,onChange:e=>Ge({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Amount per adult"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-amount",value:Ye.perPersonPence/100,min:0,max:100,format:e=>`\xa3${e}`,onChange:e=>Ge({perPersonPence:100*e}),label:"deposit per person"})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"From this many adults"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-party",value:Ye.fromParty,min:1,max:30,onChange:e=>Ge({fromParty:e}),label:"deposit from this many adults"})]}),(0,W.jsx)(j.T,{children:"Refundable?"}),(0,W.jsxs)(j.Row,{wrap:!0,gap:8,children:[(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-yes",label:"Yes",selected:!0===Ye.refundable,onPress:()=>Ge({refundable:!0})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-no",label:"No",selected:!1===Ye.refundable,onPress:()=>Ge({refundable:!1,cutoffHours:null})}),(0,W.jsx)(j.Chip,{testID:"adv-deposit-ref-unset",label:"Not set yet",selected:null===Ye.refundable,onPress:()=>Ge({refundable:null,cutoffHours:null})})]}),!0===Ye.refundable?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Refunded if cancelled this many hours before"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-cutoff",value:Ye.cutoffHours??0,min:0,max:168,step:6,format:e=>e?`${e} h`:'Any time',onChange:e=>Ge({cutoffHours:e||null}),label:"refund cut-off hours"})]}):null,(0,W.jsx)(j.T,{children:"Words guests see (optional)"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Deposit policy shown to guests",testID:"adv-deposit-policy",value:Ye.policy,multiline:!0,onChangeText:e=>Ge({policy:e.slice(0,600)}),placeholder:"e.g. The deposit comes off your bill on the night.",placeholderTextColor:R.colours.muted,style:{minHeight:70,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,padding:10,fontSize:15}}),(0,W.jsx)(j.Muted,{size:13,children:Ye.on&&Ye.perPersonPence>0?`Guests booking for ${Ye.fromParty} or more adults see: \u201c${(0,w.depositWords)(Ye,Ye.fromParty,x.name).join(' ')}\u201d`:'Off: no booking asks for a deposit.'}),(0,W.jsx)(j.Toggle,{testID:"adv-deposit-wixlinks",label:"Send website bookings deposit links for phone and walk-in bookings",a11y:"Send website bookings deposit links for phone and walk-in bookings",value:!!Ye.wixLinksOn,onChange:e=>Ge({wixLinksOn:e})}),Ye.wixLinksOn?(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{children:"Link works for"}),(0,W.jsx)(j.Stepper,{testID:"adv-deposit-linkhours",value:Ye.wixLinkHours??48,min:6,max:168,step:6,format:e=>`${e} hours`,onChange:e=>Ge({wixLinkHours:e}),label:"hours a deposit link works"})]}):null,(0,W.jsx)(j.Muted,{size:13,children:Ye.wixLinksOn?'On here, but website bookings deposit links also need the server switch, which stays off until the first \xa31 test is approved. Until then the button says so and nothing goes to website bookings.':'Off: no deposit links. Bookings work as before.'}),(0,W.jsx)(j.Muted,{size:13,children:"Tip: deposits are paid through website bookings, never in CoverCharge, and no card is saved. Guests who book on your website pay there, and the booking shows Deposit paid on website bookings by itself. For phone and walk-in bookings, tick Deposit paid once the guest has paid you, or send a website bookings deposit link. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. This does not grant access to other financial or HR information."})]}),Ke=(0,W.jsx)(k.LoyaltySettingsPanel,{}),Qe=(0,W.jsx)(se,{rid:P}),Ve=[{id:'bookings',title:'Bookings',words:'allergen allergy dog dogs cap limit access wheelchair step-free vegan vegetarian veg table request',reset:['dogQuestion','maxDogsPerSlot','accessQuestion','dietQuestion','tableRequests'],body:re,help:'adv-bookings'},{id:'times',title:'Table times',words:'dwell table time turn how long minutes party size next table free',reset:['dwellBands','dwellLearn'],body:he,help:'adv-table-times'},{id:'reserve',title:'Reservable items',words:'platter seafood crab lobster reserve price stock',reset:['reservables','reserveStock'],body:ge,help:'adv-reservable'},{id:'events',title:'Regular events',words:'open mic night music night event repeat monthly weekly promote busier forecast last food',reset:['regularEvents'],body:je,help:'adv-events'},{id:'hours',title:'Kitchen hours & last food orders',words:'hours kitchen season winter summer open close closed special day last food orders cutoff drinks',reset:['hourSets','hourOverrides','lastFoodByDay','afterLastFood'],body:Pe,help:'adv-hours'},{id:'home',title:'Display & home',words:'covers counter flip sound takeaway next table free home display',reset:['coversCounter','nextTableFree','showTakeaway'],body:Oe,help:'adv-home'},{id:'deposits',title:'Deposits',words:'deposit deposits per person party size refund refundable cut off policy paid due booking money wix link pay link online',reset:['deposit'],body:qe,help:'adv-deposits'},{id:'loyalty',title:'Loyalty: stamp card, offers & bring a friend',words:'loyalty stamp stamps card reward rewards offer offers referral refer friend bring expiry',reset:[],body:Ke,help:'adv-loyalty',noReset:!0},{id:'tableorder',title:'Order at the table',words:'order at table qr code scan phone guest menu tables areas accept first order last orders kitchen cut off print sheet pdf pay bar till',reset:[],body:o.IS_GREENSIDE?(0,W.jsx)(a.GreensideCashOnly,{}):(0,W.jsx)(r.TableOrderSettings,{rid:P,me:V}),help:'adv-table-order',noReset:!0},{id:'whatsapp',title:'WhatsApp',words:'whatsapp wa.me message chat guest phone mobile number tap',reset:['whatsapp'],body:Fe,help:'adv-whatsapp'},{id:'reminders',title:'Reminders',words:'reminder reminders break breaks chairs tables close closing shift staff nudge 6 hours law snooze later done',reset:[],body:Qe,help:'adv-reminders',onReset:()=>Z(P)},{id:'notifications',title:'Notifications',words:'notification notifications push phone scheduled order milk mills pieroni pieronis fish veg olsen rota upload remind time send',reset:[],body:(0,W.jsx)(B.NotificationsSettings,{rid:P}),help:'adv-notifications',onReset:()=>F.useNotifs.getState().resetSeeds(P)},{id:'orderlists',title:'Order lists',words:'order list lists alsons drinks cash carry trip shopping supplier logo staff add',reset:[],body:(0,W.jsx)(B.OrderListsSettings,{rid:P}),help:'adv-order-lists',onReset:()=>(0,B.resetOrderLists)(P)},{id:'tasks',title:'Tasks',words:'daily tasks library jobs checklist duties to do todo',reset:[],body:(0,W.jsx)(c.TaskLibrarySettings,{rid:P}),help:'adv-tasks',onReset:()=>b.useDailyTasks.getState().resetLibrary(P)},{id:'cashup',title:'Cash up',words:'cash up sheet takings till float card cash tips weekly sales report pos printout figures fields vat covers',reset:[],body:(0,W.jsx)(p.CashUpSettings,{rid:P}),help:'adv-cashup',onReset:()=>g.useCashUp.getState().resetFields(P)},{id:'tips',title:'Tips',words:'tips pot today tips show hide staff apps payout correction',reset:[],body:(0,W.jsx)(p.TipsSettings,{rid:P}),help:'adv-tips',onReset:()=>g.useCashUp.getState().setShow(P,{showToday:!0,showPot:!0})},{id:'clockarea',title:'Clock-in area',words:'clock in out geofence location area radius gps break forgot forgotten rota visiting map',reset:[],body:(0,W.jsx)(B.ClockAreaSettings,{rid:P,me:V}),help:'adv-clock-area',onReset:()=>(0,B.resetClockArea)(P,V)},{id:'checkout',title:'Shift check-out & question board',words:'check out checkout morale mood staffing staff enough overstaffed survey anonymous question board vote shout out shoutout wellbeing hr wording',reset:['hr'],body:(0,W.jsx)(u.HrSettingsCard,{rid:P}),help:'adv-checkout'},{id:'forecast',title:'Forecast history',words:'forecast history weeks estimate walk-ins opening hours minimum covers floor saturday sunday labour sales example figures not enough history',reset:['forecastMinWeeks'],body:Ue,help:'adv-forecast'},{id:'soldout',title:'Sold out reminders',words:'sold out 86 eighty six run out ran out back on clear end of service morning display strip auto automatic counts shellfish lobster crab platter link uses',reset:['soldOut'],body:Ne,help:'adv-soldout'},{id:'tablegrid',title:'Table plan grid',words:'table plan grid snap line up align tidy tables floor layout guides spacing restore',reset:[],body:(0,W.jsx)(I.GridSettings,{rid:P,me:V}),help:'adv-tablegrid',onReset:()=>{const e=A.useFloor.getState().settings[P];A.useFloor.getState().setSettings(P,{...A.DEFAULT_SETTINGS,...e??{},gridSnap:!0,gridSize:25})}},{id:'printers',title:'Printers',words:'print printer printers printing ticket tickets kitchen ticket docket receipt epson star bluetooth wifi reprint takeaway auto front of house copies',reset:[],body:(0,W.jsx)(z.PrintersSettings,{rid:P,go:e}),help:'adv-printers',onReset:()=>{const e=A.useFloor.getState().settings[P];e&&A.useFloor.getState().setSettings(P,{...e,printing:void 0})}},{id:'blocks',title:'Block bookings: lunch, dinner and website bookings',words:'block blocks blocked pause close lunch dinner service times wix website online push',reset:[],noReset:!0,body:(0,W.jsx)(d.BlockSettings,{rid:P}),help:'adv-blocks'},{id:'giftqr',title:'Gift cards on the Display',words:'gift card cards voucher qr code display buy sell wix website page link',reset:[],noReset:!0,body:(0,W.jsx)(i.GiftQrSettings,{rid:P}),help:'adv-giftqr'},{id:'holidays',title:'Holiday names',words:'bank holiday substitute day names',reset:['holidayFullNames'],body:$e,help:'adv-holidays'}],Ze=ee.trim().toLowerCase(),Je=(0,m.useMemo)(()=>Ve.filter(e=>!Ze||`${e.title} ${e.words}`.toLowerCase().includes(Ze)),[Ze,Ve]);return(0,W.jsxs)(y.default,{style:{gap:12},testID:"advanced-settings",children:[(0,W.jsx)(j.Muted,{children:"Owners and managers only. Changes are shared with your team\u2019s devices."}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Search settings",testID:"advanced-search",value:ee,onChangeText:te,placeholder:"Search, e.g. dogs, Open Mic Night, hours",placeholderTextColor:R.colours.muted,style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:R.colours.accentBorder,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:12,fontSize:16}}),oe?(0,W.jsx)(j.Banner,{kind:"success",title:oe}):null,Je.length?null:(0,W.jsxs)(j.Muted,{children:["No settings match \u201c",ee,"\u201d."]}),Je.map(s=>(0,W.jsx)(j.Card,{children:(0,W.jsxs)(y.default,{testID:`adv-${s.id}`,style:{gap:10},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{size:17,weight:"semibold",colour:R.colours.gold,children:s.title}),e?(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`Help: ${s.title}`,onPress:()=>e('more','help'),hitSlop:8,style:{minHeight:44,minWidth:44,justifyContent:'center'},children:(0,W.jsx)(j.T,{colour:R.colours.muted,children:"? Help"})}):null]}),s.body,s.noReset?null:(0,W.jsx)(j.Row,{style:{justifyContent:'flex-end'},children:(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Reset to default",testID:`reset-${s.id}`,onPress:()=>ne(s)})})]})},s.id))]})},Object.defineProperty(_e,"ADVANCED_DEFAULTS",{enumerable:!0,get:function(){return V}}),_e.SeasonsTodo=function({go:e}){const{r:s}=(0,D.useCtx)(6e4),t=(0,C.hourSetsOf)(s),o=[],a=t.filter(e=>!e.hours).map(e=>e.name);a.length&&o.push(`${a.join(' and ')} kitchen hours`);t.length>1&&t.some(e=>!e.start)&&o.push('the date each season starts');return o.length?(0,W.jsx)(j.Card,{onPress:()=>e('more','advanced'),highlight:R.colours.gold,children:(0,W.jsxs)(y.default,{testID:"seasons-todo",style:{gap:4},children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,W.jsx)(j.T,{weight:"semibold",colour:R.colours.gold,children:"Setup checklist: kitchen hours"}),(0,W.jsx)(j.T,{colour:R.colours.muted,children:"\u203a"})]}),(0,W.jsxs)(j.Muted,{size:13,children:["Please add ",o.join(' and ')," (Settings \u203a Advanced \u203a Kitchen hours). Until then the app uses the Winter hours all year."]})]})}):null};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),a=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),i=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),g=_r(_d[13]),b=_r(_d[14]),m=_r(_d[15]),x=e(m),f=e(_r(_d[16])),y=e(_r(_d[17])),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),v=_r(_d[21]),C=_r(_d[22]),S=_r(_d[23]),T=_r(_d[24]),R=_r(_d[25]),D=_r(_d[26]),M=_r(_d[27]),L=_r(_d[28]),P=_r(_d[29]),O=_r(_d[30]),$=_r(_d[31]),I=_r(_d[32]),z=_r(_d[33]),A=_r(_d[34]),B=_r(_d[35]),F=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),W=_r(_d[39]);const H=/^([01]\d|2[0-3]):[0-5]\d$/,U=/^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,_=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,Y=[1,2,3,4,5,6,0],G=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];function q({value:e,onChange:s,placeholder:t,label:o,width:a=90,bad:l,testID:r}){return(0,W.jsx)(n.TextInput,{accessibilityLabel:o,testID:r,value:e,onChangeText:s,placeholder:t,placeholderTextColor:R.colours.muted,style:{width:a,minHeight:44,borderRadius:10,borderWidth:1,borderColor:l?R.colours.red:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}})}function K({value:e,onChange:s,min:t,max:o,unit:a,label:n,step:l=5}){const r=(a,l)=>(0,W.jsx)(f.default,{accessibilityRole:"button",accessibilityLabel:`${l<0?'Less':'More'}: ${n}`,onPress:()=>s(Math.min(o,Math.max(t,e+l))),style:{width:44,height:44,borderRadius:10,borderWidth:1,borderColor:R.colours.accentBorder,alignItems:'center',justifyContent:'center'},children:(0,W.jsx)(j.T,{size:20,colour:R.colours.gold,children:a})});return(0,W.jsxs)(j.Row,{gap:8,children:[r('\u2212',-l),(0,W.jsx)(j.T,{weight:"semibold",style:{minWidth:76,textAlign:'center'},children:a(e)}),r('+',l)]})}const Q=e=>e%60?`${Math.floor(e/60)}h ${e%60}m`:`${e/60} hour${60===e?'':'s'}`;const V={DEFAULT_DWELL:T.DEFAULT_DWELL,ANCHORAGE_SEASONS:C.ANCHORAGE_SEASONS};function Z(e){const s=P.useReminders.getState();s.ensure(e),s.resetRules(e),s.resetReminder((0,P.chairsId)(e))}const J=[1,2,3,4,5,6,0],X=e=>`${7===e.days.length?'Every day':J.filter(s=>e.days.includes(s)).map(e=>O.DAY_NAMES[e]).join(', ')||'No days'} at ${e.time} (UK time) \xb7 ${O.AUDIENCE_LABEL[e.audience]}`;function ee({init:e,onSave:s,onCancel:t}){const[o,a]=(0,m.useState)(e.text),[l,r]=(0,m.useState)(e.days),[i,d]=(0,m.useState)(e.time),[h,u]=(0,m.useState)(e.audience),c=o.trim().length>1&&l.length>0&&(0,O.validTime)(i);return(0,W.jsxs)(y.default,{testID:"reminder-editor",style:{gap:8,borderWidth:1,borderColor:R.colours.accentBorder,borderRadius:12,padding:10},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"What it says"}),(0,W.jsx)(n.TextInput,{accessibilityLabel:"Reminder wording",testID:"reminder-text",value:o,onChangeText:a,maxLength:120,placeholder:"e.g. Time to put the chairs up on the tables",placeholderTextColor:R.colours.muted,style:{minHeight:44,borderRadius:10,borderWidth:1,borderColor:R.colours.hairline,backgroundColor:R.colours.surface2,color:R.colours.text,paddingHorizontal:10,fontSize:15}}),(0,W.jsx)(j.T,{weight:"semibold",children:"Days"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:J.map(e=>(0,W.jsx)(j.Chip,{label:O.DAY_NAMES[e],selected:l.includes(e),onPress:()=>r(l.includes(e)?l.filter(s=>s!==e):[...l,e])},e))}),(0,W.jsxs)(j.Row,{gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Time (UK)"}),(0,W.jsx)(q,{label:"Reminder time",testID:"reminder-time",value:i,onChange:d,placeholder:"21:00",bad:!(0,O.validTime)(i)})]}),(0,W.jsx)(j.T,{weight:"semibold",children:"Who sees it"}),(0,W.jsx)(j.Row,{wrap:!0,gap:6,children:['all','foh','kitchen'].map(e=>(0,W.jsx)(j.Chip,{label:O.AUDIENCE_LABEL[e],selected:h===e,onPress:()=>u(e)},e))}),c?null:(0,W.jsx)(j.Muted,{size:13,children:"Add the wording, at least one day and a time like 21:00."}),(0,W.jsxs)(j.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:t}),(0,W.jsx)(j.Button,{small:!0,label:"Save reminder",testID:"reminder-save",disabled:!c,onPress:()=>s({text:o.trim(),days:[...l].sort(),time:i,audience:h})})]})]})}function se({rid:e}){x.default.useEffect(()=>{P.useReminders.getState().ensure(e)},[e]);const s=(0,P.useReminders)(e=>e.reminders),t=s.filter(s=>s.rid===e&&!s.removed),o=(0,P.useReminders)(s=>s.rules[e]),a=(0,O.clampRules)(o??O.DEFAULT_BREAK_RULES),n=(0,P.useReminders)(e=>e.done).filter(s=>s.rid===e).slice(0,5),l=(0,$.useOwner)(e=>e.staff),r=P.useReminders.getState(),[i,d]=(0,m.useState)(null),[h,u]=(0,m.useState)(null),c=s=>r.setRules(e,s);return(0,W.jsxs)(y.default,{style:{gap:10},testID:"reminders-settings",children:[(0,W.jsx)(j.Muted,{size:13,children:"Reminders slide up on the phones of staff who are on shift right now (clocked in, or on the rota at that time), in the Staff and Head Chef apps, while the app is open."}),(0,W.jsx)(j.T,{weight:"semibold",children:"Break reminders"}),(0,W.jsx)(j.Toggle,{label:"Remind staff to take their break",value:a.on,onChange:e=>c({on:e})}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{center:!0,style:{width:'100%'},children:"First reminder, if the rota has no break time"}),(0,W.jsx)(K,{label:"first break reminder",step:15,min:30,max:O.LEGAL_LIMIT_MINS,value:a.afterMins,unit:e=>`${Q(e)} in`,onChange:e=>c({afterMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"Remind once more after"}),(0,W.jsx)(K,{label:"second break reminder",step:5,min:5,max:120,value:a.repeatMins,unit:e=>`${e} min`,onChange:e=>c({repeatMins:e})})]}),(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},wrap:!0,children:[(0,W.jsx)(j.T,{style:{flex:1},children:"\u2018Later\u2019 hides it for"}),(0,W.jsx)(K,{label:"snooze",step:5,min:5,max:60,value:a.snoozeMins,unit:e=>`${e} min`,onChange:e=>c({snoozeMins:e})})]}),(0,W.jsxs)(j.Muted,{size:13,children:["How it works: if the shift on the rota has a break time, the reminder comes at that time. If not, it comes ",Q(a.afterMins)," after they clock in (or after the shift starts, if they haven\u2019t clocked in). If they still haven\u2019t started a break, it comes once more ",a.repeatMins," minutes later, and again at 6 hours. Nobody works more than 6 hours without a reminder: UK law says a shift over 6 hours needs a 20-minute break. \u2018Start break\u2019 starts their break, the same as on the clock screen."]}),(0,W.jsx)(j.T,{weight:"semibold",style:{marginTop:6},children:"Venue reminders"}),t.map(e=>(0,W.jsx)(y.default,{testID:`reminder-${e.builtIn??e.id}`,style:{gap:6,borderBottomWidth:1,borderColor:R.colours.hairline,paddingBottom:8},children:i===e.id?(0,W.jsx)(ee,{init:e,onCancel:()=>d(null),onSave:s=>{r.update(e.id,s),d(null)}}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(j.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,W.jsx)(j.T,{weight:"semibold",style:{flex:1},children:e.text}),e.paused?(0,W.jsx)(j.Badge,{kind:"amber",label:"PAUSED"}):null]}),(0,W.jsx)(j.Muted,{size:13,children:X(e)}),h===e.id?(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.T,{size:14,style:{flex:1},children:"Delete this reminder?"}),(0,W.jsx)(j.Button,{small:!0,kind:"danger",label:"Yes, delete it",onPress:()=>{r.remove(e.id),u(null)}}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>u(null)})]}):(0,W.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"Edit",testID:"reminder-edit",onPress:()=>d(e.id)}),(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:e.paused?'Resume':'Pause',onPress:()=>r.update(e.id,{paused:!e.paused})}),(0,W.jsx)(j.Button,{small:!0,kind:"ghost",label:"Delete",onPress:()=>u(e.id)})]})]})},e.id)),t.length?null:(0,W.jsx)(j.Muted,{children:"No venue reminders. Add one below, or Reset to default to bring back \u201cchairs up\u201d."}),'new'===i?(0,W.jsx)(ee,{init:{text:'',days:[5,6],time:'21:00',audience:'all'},onCancel:()=>d(null),onSave:s=>{r.add(e,s),d(null)}}):(0,W.jsx)(j.Button,{small:!0,kind:"secondary",label:"\uff0b Add a reminder",testID:"reminder-add",onPress:()=>d('new')}),n.length?(0,W.jsxs)(y.default,{style:{gap:2},children:[(0,W.jsx)(j.T,{weight:"semibold",children:"Recently done"}),n.map(e=>(0,W.jsxs)(j.Muted,{size:13,children:[new Date(e.at).toLocaleString('en-GB',{weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})," \xb7 ",(l.find(s=>s.id===e.staffRef)?.name??e.staffName).replace(' (example)','')," \xb7 ",s.find(s=>s.id===e.reminderId)?.text??'Reminder']},e.id))]}):null,(0,W.jsxs)(j.Muted,{size:13,children:["Tip: once anyone taps Done, the reminder goes away for everyone that day, and you can see who did it here. \u2018Later\u2019 hides it on that phone for ",a.snoozeMins," minutes. Reset to default puts back the break times and \u201cchairs up\u201d (",(0,O.defaultChairs)('x',e).days.map(e=>O.DAY_NAMES[e]).join(' and '),", 21:00); your own reminders stay."]}),(0,W.jsx)(j.Muted,{size:13,children:"Reminders show while the app is open. Phones with the app closed don\u2019t get them yet."})]})}},1434,[1053,1033,805,1421,812,1435,1436,1438,1439,1440,1203,1031,1032,1008,1014,17,385,85,777,841,1441,816,862,1055,861,804,1057,858,1187,926,927,876,1442,1395,998,1443,1005,1142,892,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ForecastDaySettings=function({r:t,set:s}){const c=(0,o.forecastHoursOf)(t),y=(0,o.minCoversOf)(t),v=t.settings.minCoversNote??('anchorage'!==t.id||t.settings.minCoversByDay?void 0:o.MIN_COVERS_NOTE),x=(e,t,n)=>{const i=c[e]??['12:00','22:00'],o=0===t?[n,i[1]]:[i[0],n];h(o[0])&&h(o[1])&&s({forecastHours:{...c,[e]:o}})},f=(e,t)=>{const n=''===t.trim()?null:Math.max(0,Math.min(999,Math.round(Number(t)||0)));s({minCoversByDay:{...y,[e]:n||null},minCoversNote:void 0})};return(0,u.jsxs)(n.default,{style:{gap:8},testID:"forecast-day-settings",children:[(0,u.jsx)(i.T,{children:"Opening hours shown on the forecast"}),(0,u.jsx)(i.Muted,{size:13,children:"The hours your bar or dining room is open, so the forecast covers the whole day, not just kitchen hours. Any hour with a booking always shows."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),c[t]?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(e.TextInput,{testID:`fc-open-${t}`,accessibilityLabel:`${r.DAYS[t]} opens`,defaultValue:c[t][0],onEndEditing:e=>x(t,0,e.nativeEvent.text),onBlur:e=>x(t,0,e?.target?.value??c[t][0]),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.T,{size:15,children:"to"}),(0,u.jsx)(e.TextInput,{testID:`fc-close-${t}`,accessibilityLabel:`${r.DAYS[t]} closes`,defaultValue:c[t][1],onEndEditing:e=>x(t,1,e.nativeEvent.text),onBlur:e=>x(t,1,e?.target?.value??c[t][1]),style:[i.styles.input,{width:90,minHeight:44}]})]}):(0,u.jsx)(i.Muted,{children:"Kitchen hours"})]},`h${t}`)),(0,u.jsx)(i.T,{style:{marginTop:8},children:"Usual minimum Covers"}),(0,u.jsx)(i.Muted,{size:13,children:"The fewest Covers you always do on that day. The forecast never shows less. Leave blank if you have no usual minimum."}),d.map(t=>(0,u.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,u.jsx)(i.T,{center:!0,size:15,style:{width:'100%'},children:r.DAYS[t]}),(0,u.jsx)(e.TextInput,{testID:`fc-min-${t}`,accessibilityLabel:`${r.DAYS[t]} usual minimum Covers`,keyboardType:"number-pad",defaultValue:y[t]?String(y[t]):'',placeholder:"Blank",placeholderTextColor:"#7D776C",onEndEditing:e=>f(t,e.nativeEvent.text),onBlur:e=>f(t,e?.target?.value??''),style:[i.styles.input,{width:90,minHeight:44}]}),(0,u.jsx)(i.Muted,{children:"Covers"})]},`m${t}`)),v?(0,u.jsxs)(i.T,{size:13,colour:l.colours.goldLight,children:["Set from ",v,"."]}):null,(0,u.jsx)(i.Muted,{size:13,children:"Tip: use a number you are sure of, such as the quietest Saturday in the last few months."})]})};var e=_r(_d[0]);_r(_d[1]);var t,s=_r(_d[2]),n=(t=s)&&t.__esModule?t:{default:t},i=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),u=_r(_d[7]);const d=[1,2,3,4,5,6,0],h=e=>/^([01]\d|2[0-3]):[0-5]\d$/.test(e)},1435,[812,17,85,777,1140,861,804,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderSettings=function({rid:s,me:a}){const k=(0,r.useRestaurant)(s),v=(0,o.usePlan)(s),T=(0,h.staffServer)(),R=!T||(0,b.can)('venue.settings'),[C,S]=(0,t.useState)({...c.TABLE_ORDER_DEFAULT}),[N,P]=(0,t.useState)([]),[$,D]=(0,t.useState)(null),[M,Q]=(0,t.useState)(!1),[O,B]=(0,t.useState)(!1),[A,I]=(0,t.useState)(null),[_,L]=(0,t.useState)(null),[F,E]=(0,t.useState)('sticker'),G=(0,t.useCallback)(async()=>{if(T)try{S(await(0,u.loadTableSettings)()),B(!1),(0,b.can)('venue.settings')&&(P(await(0,u.listTableCodes)()),I(await(0,u.tableReadiness)().catch(()=>null)))}catch(e){D({kind:'danger',t:`Couldn't load: ${e.message}`})}},[T]);(0,t.useEffect)(()=>(G(),T?(0,u.watchTableSettings)(()=>{O||G()}):void 0),[G]);const z=e=>{S(t=>({...t,...e})),B(!0),D(null)},W=v.tables.map(e=>e.name).filter(c.isTableNo).sort((e,t)=>Number(e)-Number(t)),H=C.tables??W,U=e=>z({tables:H.includes(e)?H.filter(t=>t!==e):[...H,e].sort((e,t)=>Number(e)-Number(t))}),Y=e=>v.tables.filter(t=>t.areaId===e).map(e=>e.name).filter(c.isTableNo),q=e=>{const t=Y(e);return t.length>0&&t.every(e=>H.includes(e))},J=e=>{const t=Y(e),s=q(e);z({tables:s?H.filter(e=>!t.includes(e)):[...new Set([...H,...t])].sort((e,t)=>Number(e)-Number(t))})},K=async()=>{Q(!0);try{const e=C.tables&&C.tables.length===W.length&&W.every(e=>C.tables.includes(e))?null:C.tables;T&&await(0,u.saveTableSettings)({...C,tables:e},a),r.useStore.getState().updateSettings(s,{orderAtTable:C.on}),B(!1),D({kind:'success',t:C.on?'Saved. Guests can order from the tables you picked.':'Saved. Order at the table is off.'})}catch(e){D({kind:'danger',t:`Not saved: ${e.message}`})}Q(!1)},V=async()=>{Q(!0);try{const e=await(0,u.makeTableCodes)(H);P(await(0,u.listTableCodes)()),D({kind:'success',t:e.made?`Made ${e.made} new QR code${e.made>1?'s':''}.`:'Every table you picked already has a code.'})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},X=async t=>{Q(!0),L(null);try{await(0,u.renewTableCode)(t),P(await(0,u.listTableCodes)()),D({kind:'warn',t:`Table ${(0,e.tableNumbers)(t)} has a new code. The old QR on that table has stopped working, so print this one and swap it.`})}catch(e){D({kind:'danger',t:e.message})}Q(!1)},Z=e=>{const t=N.filter(t=>e?t.table===e:H.includes(t.table)),s=(0,p.printQrSheet)(k?.name??'Our venue',t.map(e=>({table:e.table,link:(0,c.tableLink)(w(),e.token)})),{logo:`${w()}/customer-app/brand-logo.png`,size:F});D(s?{kind:'success',t:'QR sheet opened. Choose "Save as PDF" or your printer.'}:{kind:'warn',t:'Printing works from the web app on a computer or tablet.'})};return T?(0,f.jsxs)(n.default,{style:{gap:10},testID:"table-order-settings",children:[(0,f.jsx)(l.Muted,{center:!0,children:"Tip: start with a few tables and keep \"Staff accept the first order\" on. Guests pay at the bar or with their server, and the kitchen gets the order like any other ticket."}),A&&A.priced>0&&A.signedz({on:e}),disabled:!R,testID:"tos-on"}),(0,f.jsx)(l.Toggle,{label:"Staff accept the first order from each new phone",value:C.staffAccept,onChange:e=>z({staffAccept:e}),disabled:!R}),(0,f.jsx)(l.Muted,{children:"On is safer: someone sat at the table can't be told apart from someone who photographed the QR. After staff accept one order, that phone's next orders go straight to the kitchen for 12 hours."}),(0,f.jsx)(l.T,{weight:"semibold",children:"Which areas and tables"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:v.areas.filter(e=>Y(e.id).length).map(e=>(0,f.jsx)(l.Chip,{label:e.name,selected:q(e.id),onPress:R?()=>J(e.id):void 0},e.id))}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:W.map(t=>(0,f.jsx)(l.Chip,{label:`${(0,e.tableNumbers)(t)}`,selected:H.includes(t),onPress:R?()=>U(t):void 0},t))}),(0,f.jsxs)(l.Muted,{children:[C.tables?`${H.length} of ${W.length} tables`:'All tables',"."]}),(0,f.jsx)(l.T,{weight:"semibold",children:"Hours"}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Opens at"}),(0,f.jsx)(l.Stepper,{label:"Opens at",value:j(C.openFrom),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({openFrom:x(e)})})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Last orders (kitchen cut-off)"}),(0,f.jsx)(l.Stepper,{label:"Last orders",value:j(C.lastOrders),min:-15,max:1425,step:15,format:y,onChange:e=>R&&z({lastOrders:x(e)})})]}),(0,f.jsx)(l.Muted,{children:(0,c.hoursWords)(C)}),(0,f.jsx)(l.Field,{label:"Note guests see above the menu (optional)",value:C.guestTip,onChangeText:e=>z({guestTip:e.slice(0,160)}),editable:R,placeholder:"e.g. Drinks are ordered at the bar."}),R?(0,f.jsx)(l.Button,{label:M?'Saving\u2026':'Save order at the table',disabled:M||!O,onPress:()=>{K()},testID:"tos-save"}):null,$?(0,f.jsx)(l.Banner,{kind:$.kind,children:$.t}):null,R?(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:"QR codes"}),(0,f.jsx)(l.Badge,{kind:"gold",label:`${N.length} made`})]}),(0,f.jsx)(l.Muted,{children:"Each table gets its own code. A guest can only order with the code that's on the table."}),(0,f.jsx)(l.T,{center:!0,size:13,weight:"semibold",children:"Card size"}),(0,f.jsx)(n.default,{testID:"tos-card-size",children:(0,f.jsx)(l.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:Object.keys(p.QR_CARD).map(e=>(0,f.jsx)(l.Chip,{label:p.QR_CARD[e].label,selected:F===e,onPress:()=>E(e)},e))})}),(0,f.jsxs)(l.Muted,{center:!0,children:['sticker'===F?'For stickers and small QR table stands: 20 to a page, QR 30 mm.':'For table stand cards (about 2 \xd7 3 in): 16 to a page, QR 34 mm, with the short link.'," Print at 100% (actual size), then cut along the dashed lines."]}),(0,f.jsxs)(l.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,f.jsx)(l.Button,{small:!0,label:"Make codes for the tables picked",disabled:M,onPress:()=>{V()}}),(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Print all QR cards",disabled:!N.length,onPress:()=>Z(),testID:"tos-print"})]}),N.map(t=>(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(l.T,{children:["Table ",(0,e.tableNumbers)(t.table),H.includes(t.table)?'':' (not taking orders)']}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Button,{small:!0,kind:"secondary",label:"Reprint",accessibilityLabel:`Reprint the QR for table ${t.table}`,disabled:M,onPress:()=>Z(t.table),testID:`tos-reprint-${t.table}`}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"New code",accessibilityLabel:`New code for table ${t.table}`,disabled:M,onPress:()=>L(t.table),testID:`tos-renew-${t.table}`})]})]},t.table)),(0,f.jsx)(l.Muted,{children:"Lost or copied QR? Make a new code for that table; the old one stops working."})]}):null,(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",children:"Paying"}),(0,f.jsx)(l.Muted,{center:!0,children:"Guests pay at the bar or with their server. Paying by card from the phone is coming later; no card details are asked for."})]}),_?(0,f.jsxs)(l.Sheet,{visible:!0,onClose:()=>L(null),title:`New code for table ${(0,e.tableNumbers)(_)}?`,maxWidth:520,testID:"tos-renew-confirm",children:[(0,f.jsxs)(l.T,{center:!0,children:["The QR code on table ",(0,e.tableNumbers)(_)," stops working straight away. Guests who scan the old one are told to ask a member of staff."]}),(0,f.jsx)(l.Muted,{center:!0,children:"Print the new one and swap it on the table."}),(0,f.jsx)(l.Button,{label:"Yes, make a new code",onPress:()=>{X(_)},testID:"tos-renew-yes"}),(0,f.jsx)(l.Button,{kind:"secondary",label:"Cancel",onPress:()=>L(null)})]}):null]}):(0,f.jsx)(l.Banner,{kind:"demo",title:"Needs the venue connection",children:"Order at the table runs on the server, so it works once this app is connected to your venue. Nothing here is sent anywhere."})};var e=_r(d[0]),t=_r(d[1]);_r(d[2]);var s,a=_r(d[3]),n=(s=a)&&s.__esModule?s:{default:s},l=_r(d[4]),r=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),b=_r(d[9]),u=_r(d[10]),p=_r(d[11]),f=_r(d[12]);const w=()=>'undefined'!=typeof window&&/^https:/.test(window.location.origin)?window.location.origin:"https://covercharge-apps.static.hf.space",j=e=>e?60*Number(e.slice(0,2))+Number(e.slice(3,5)):-15,x=e=>e<0?null:(0,c.hm)(e),y=e=>e<0?'Not set':(0,c.hm)(e)},1436,[843,17,219,85,777,858,998,1154,1263,899,1338,1437,8]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.qrSvg=n,Object.defineProperty(e,"QR_CARD",{enumerable:!0,get:function(){return r}}),e.qrSheetHtml=s,e.printQrSheet=function(t,o,i={}){if('undefined'==typeof window||!window.open)return!1;const n=window.open('','_blank');return!!n&&(n.document.write(s(t,o,i)),n.document.close(),n.focus(),setTimeout(()=>{try{n.print()}catch{}},800),!0)};var t=_r(_d[0]);const o=_r(_d[1]),i=t=>t.replace(/[&<>"']/g,t=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[t]));function n(t,i=220){const n=o.create(t,{errorCorrectionLevel:'M'}).modules,r=n.size,s=r+8;let l='';for(let t=0;t`}const r={sticker:{w:50,h:50,qr:30,cols:4,rows:5,label:'Stickers 50 \xd7 50 mm'},stand:{w:50,h:70,qr:34,cols:4,rows:4,label:'Stand cards 50 \xd7 70 mm'}};function s(o,s,l={}){const d=l.size??'sticker',c=r[d],m='stand'===d,h=l.logo?``:'',f=o=>`
${h}
${i((0,t.tableNumbersA11y)(o.table))}
${n(o.link,240)}
Scan to order
${m?`
Pay at the bar or with your server
${i(o.link.replace(/^https?:\/\//,''))}
`:''}
`,p=c.cols*c.rows,u=[];for(let t=0;t${s.slice(t,t+p).map(f).join('')}`);return`${i(o)} table QR codes \xb7 ${c.label}

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

${u.join('')}`}},1437,[843,1285]); +__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])},1438,[17,85,777,998,1348,804,8]); +__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},1439,[17,85,777,998,863,1403,805,8]); +__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}},1440,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltySettingsPanel=function(){const e=(0,c.staffServer)(),[s,n]=(0,t.useState)(null),[f,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,c.readSettings)(),(0,c.readOffers)()]);n(e),y(t)}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}},[]);if((0,t.useEffect)(()=>{if(e)return v(),(0,c.watchLoyalty)(()=>{v()})},[e,v]),!e)return(0,h.jsx)(o.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,h.jsx)(o.Muted,{children:"Loading\u2026"});const O=e=>{n({...s,...e}),j(null)},S=(0,u.checkSettings)(s),T=async()=>{if(!S){b(!0);try{await(0,c.saveSettings)(s),j({kind:'success',text:'Saved. Every device shows the new card.'})}catch(e){j({kind:'warn',text:(0,u.plainError)(e)})}b(!1)}},C=e=>e?`${e} days`:'Never';return(0,h.jsxs)(a.default,{style:{gap:10},testID:"adv-loyalty-panel",children:[(0,h.jsx)(o.T,{weight:"semibold",children:"Stamp card"}),(0,h.jsx)(o.Toggle,{testID:"loy-card-on",label:"Stamp card on",value:s.cardOn,onChange:e=>O({cardOn:e})}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps for a reward"}),(0,h.jsx)(o.Stepper,{value:s.stampsNeeded,min:2,max:20,onChange:e=>O({stampsNeeded:e}),label:"stamps for a reward"})]}),(0,h.jsx)(o.Field,{testID:"loy-reward",label:"The reward",value:s.reward,onChangeText:e=>O({reward:e.slice(0,80)}),placeholder:"e.g. Free dessert"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Stamps run out after"}),(0,h.jsx)(o.Stepper,{value:s.stampExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({stampExpiryDays:e}),label:"stamp expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Rewards run out after"}),(0,h.jsx)(o.Stepper,{value:s.rewardExpiryDays,min:0,max:1080,step:30,format:C,onChange:e=>O({rewardExpiryDays:e}),label:"reward expiry days"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Minutes between stamps (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.gapMinutes,min:0,max:1440,step:15,onChange:e=>O({gapMinutes:e}),label:"minutes between stamps"})]}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most stamps a day (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.maxPerDay,min:1,max:10,onChange:e=>O({maxPerDay:e}),label:"most stamps a day"})]}),(0,h.jsx)(o.T,{weight:"semibold",children:"Bring a friend"}),(0,h.jsx)(o.Toggle,{testID:"loy-ref-on",label:"Bring-a-friend on",value:s.referralOn,onChange:e=>O({referralOn:e})}),(0,h.jsx)(o.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,h.jsx)(o.Field,{label:"Reward for the friend",value:s.referralFriend,onChangeText:e=>O({referralFriend:e.slice(0,80)}),placeholder:"e.g. Free coffee"}),(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{children:"Most friend rewards a month (one guest)"}),(0,h.jsx)(o.Stepper,{value:s.referralMonthlyCap,min:0,max:50,onChange:e=>O({referralMonthlyCap:e}),label:"friend rewards a month"})]}),S?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:S}):null,p?(0,h.jsx)(o.Banner,{kind:p.kind,title:p.text}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{label:w?'Saving\u2026':'Save loyalty settings',testID:"loy-save",disabled:!!S||w,onPress:()=>{T()}}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Back to the defaults",onPress:()=>n({...u.DEFAULT_LOYALTY})})]}),(0,h.jsx)(o.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,h.jsx)(o.T,{weight:"semibold",children:"Offers"}),f.length?f.map(e=>(0,h.jsx)(x,{o:e,onSaved:v},e.id)):(0,h.jsx)(o.Muted,{children:"No offers yet."}),(0,h.jsx)(x,{onSaved:v}),(0,h.jsx)(o.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,n]=(0,t.useState)(null),[l,f]=(0,t.useState)(null),x=(0,t.useCallback)(()=>{(0,c.loyaltySummary)().then(n,e=>f((0,u.plainError)(e)))},[]);if((0,t.useEffect)(()=>{if((0,c.staffServer)())return x(),(0,c.watchLoyalty)(x)},[x]),!(0,c.staffServer)())return null;if(l)return(0,h.jsx)(o.Banner,{kind:"warn",title:"Couldn\u2019t load the summary",children:l});if(!s)return(0,h.jsx)(o.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,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:4},testID:`loyalty-summary-${e}`,children:[(0,h.jsx)(o.T,{weight:"semibold",children:'card'===e?'Stamp card so far':'Bring a friend so far'}),y.map(([e,t])=>(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.Muted,{children:e}),(0,h.jsx)(o.T,{weight:"semibold",children:t})]},e)),(0,h.jsx)(o.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=r(d[2]),a=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),o=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]);const f=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function x({o:e,onSaved:n}){const[x,y]=(0,t.useState)({title:e?.title??'',details:e?.details??'',startsOn:e?.startsOn??'',endsOn:e?.endsOn??'',isOn:e?.isOn??!0}),[p,j]=(0,t.useState)(!!e),[w,b]=(0,t.useState)(null);if(!e&&!p)return(0,h.jsx)(o.Button,{kind:"secondary",small:!0,label:"Add an offer",testID:"loy-offer-add",onPress:()=>j(!0)});const v=(!x.startsOn||f.test(x.startsOn))&&(!x.endsOn||f.test(x.endsOn))?(0,u.checkOffer)({title:x.title,details:x.details,startsOn:x.startsOn||null,endsOn:x.endsOn||null}):'Dates look like 2026-12-01.',O=async()=>{if(!v)try{await(0,c.saveOffer)({id:e?.id,title:x.title.trim(),details:x.details.trim(),startsOn:x.startsOn||null,endsOn:x.endsOn||null,isOn:x.isOn}),b('Saved.'),e||(y({title:'',details:'',startsOn:'',endsOn:'',isOn:!0}),j(!1)),n()}catch(e){b((0,u.plainError)(e))}};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(a.default,{style:{gap:6},children:[e?(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(o.T,{weight:"semibold",children:e.title}),(0,h.jsx)(o.Badge,{kind:e.isOn?'gold':'neutral',label:e.isOn?'On':'Off'})]}):(0,h.jsx)(o.T,{weight:"semibold",children:"New offer"}),(0,h.jsx)(o.Field,{label:"Title",value:x.title,onChangeText:e=>y({...x,title:e.slice(0,80)}),placeholder:"e.g. Two courses for \xa320 on Tuesdays"}),(0,h.jsx)(o.Field,{label:"Details",value:x.details,onChangeText:e=>y({...x,details:e.slice(0,500)}),multiline:!0}),(0,h.jsxs)(o.Row,{gap:8,wrap:!0,children:[(0,h.jsx)(o.Field,{label:"Starts (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.startsOn,e=>y({...x,startsOn:e.trim()})),placeholder:"01/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,h.jsx)(o.Field,{label:"Ends (optional, DD/MM/YYYY)",...(0,s.slashBox)(x.endsOn,e=>y({...x,endsOn:e.trim()})),placeholder:"24/12/2026",keyboardType:"numbers-and-punctuation",maxLength:10})]}),(0,h.jsx)(o.Toggle,{label:"Offer on",value:x.isOn,onChange:e=>y({...x,isOn:e})}),v&&(x.title||e)?(0,h.jsx)(o.T,{size:13,colour:l.colours.amber,children:v}):null,w?(0,h.jsx)(o.Muted,{size:13,children:w}):null,(0,h.jsxs)(o.Row,{gap:8,children:[(0,h.jsx)(o.Button,{small:!0,label:"Save offer",disabled:!!v,onPress:()=>{O()}}),e?null:(0,h.jsx)(o.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>j(!1)})]})]})})}},1441,[17,1033,85,804,777,1260,1263,8]); +__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)}},1442,[17,85,777,998,1369,804,8]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,f]=(0,n.useState)(null),[p,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})),S=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=>C(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>C(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:()=>f(null),onSave:t=>{y.update(e.id,t),f(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 ",S(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:()=>f(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:I,onCancel:()=>f(null),onSave:t=>{y.add(e,t),f(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>f('new')}),(0,k.jsxs)(r.Sheet,{visible:!!p,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:p?.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:()=>{p&&y.remove(p.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)(()=>{f.useOrderLists.getState().ensure(e)},[e]);const s=(0,f.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,f.orderSettingsOf)(e);(0,f.useOrderLists)(t=>t.settings[e]);const l=f.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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:S.map(t=>(0,k.jsx)(r.Chip,{label:p.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(),f=(0,s.privateClockVenue)(e),[p,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[S,v]=(0,n.useState)(!1),[C,I]=(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(f)return;v(!0),I('');const t=await(0,b.getFix)();if(v(!1),'object'!=typeof t)return void I('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),I(`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:f?'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."}),f?(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)}),f?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:S?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:S,onPress:()=>{B()}}),C?(0,k.jsx)(r.Muted,{size:13,children:C}):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:p,onChangeText:j,onBlur:()=>R(p,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(p,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."]}),f?(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:"The full CookSafe log is in the food safety menu: CookSafe log."}),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]),f=_r(_d[11]),p=_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},S=[1,2,3,4,5,6,0],v=['on_shift','everyone','managers','head_chef','kitchen','foh'],C=e=>e.replace(' (example)',''),I={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:v.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:C(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:[v.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:C(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,f]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),p=(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:S.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=>{f(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:S.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}})}),p?(0,k.jsx)(r.Muted,{size:13,children:p}):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:!!p,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=>f.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'},1443,[812,912,17,362,385,85,777,804,1005,1006,876,1010,1011,1012,913,1068,899,1029,916,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.tillTakings=t,e.takingsToday=function(n,u,l,d){const c=s=>{const l=n.find(n=>n.rid===u&&n.date===s&&!!n.confirmedAt),d=l?t(l.vals):null;return null==d?null:o(d)},y=c(l),p=s(l,-7),h=c(p),f=Math.max(0,Math.round(d||0));return{today:y,last:null==h?null:{date:p,pence:h},online:f,show:null!=y||null!=h||f>0}},Object.defineProperty(e,"money",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dayName",{enumerable:!0,get:function(){return d}}),e.changeWords=c,e.takingsSpeech=function(n){const t=[];t.push(null!=n.today?`Takings today, ${u(n.today)}, from tonight's cash up`:'Takings today, not cashed up yet'),n.last&&t.push(`Last ${d(n.last.date)}, ${u(n.last.pence)}`);const s=c(n);s&&t.push(s);n.online>0&&t.push(`Plus ${u(n.online)} paid online`);return t.push('Opens takings and reports'),t.join('. ')+'.'};const n=n=>'number'==typeof n&&Number.isFinite(n)?n:null;function t(t){const s=n(t.card),o=n(t.cash);return null!=s||null!=o?(s??0)+(o??0):n(t.gross)}const s=(n,t)=>{const s=new Date(`${n}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},o=n=>Math.round(100*n);const u=n=>`\xa3${(n/100).toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,l=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=n=>l[new Date(`${n}T12:00:00Z`).getUTCDay()];function c(n){if(null==n.today||!n.last)return null;const t=n.today-n.last.pence;return 0===t?'Same as last week':`${t>0?'Up':'Down'} ${u(Math.abs(t))} on last ${d(n.last.date)}`}},1444,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakingsTodayCard=function({t:e,example:h,onPress:y}){const x=(0,c.changeWords)(e),f=null!=e.today&&null!=e.last&&e.today(0,c.money)(Math.round(e))}):(0,u.jsx)(s.T,{center:!0,size:18,weight:"bold",colour:l.colours.text,testID:"home-takings-not-yet",children:"Not cashed up yet"}),e.last?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-last",children:["Last ",(0,c.dayName)(e.last.date),": ",(0,c.money)(e.last.pence)]}):null,x?(0,u.jsx)(s.T,{center:!0,size:13,weight:"semibold",colour:f?l.colours.amber:l.colours.gold,testID:"home-takings-change",children:x}):null,e.online>0?(0,u.jsxs)(s.T,{center:!0,size:13,colour:l.colours.muted,testID:"home-takings-online",children:["Plus ",(0,c.money)(e.online)," paid online"]}):null,(0,u.jsx)(s.T,{center:!0,size:11,colour:l.colours.muted,children:null!=e.today||e.last?'Card + cash from the cash up':'Paid online today'})]})})},r(d[0]);var o=e(r(d[1])),t=e(r(d[2])),s=r(d[3]),l=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7])},1445,[17,385,85,777,804,1149,1444,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1446,[886,779,816,813,822,862,1039,1447,17,909,319,362,219,385,85,777,858,876,863,804,1184,1057,1221,8]); +__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})({})},1447,[482,1448]); +__d(function(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={}},1448,[]); +__d(function(_g,_r,_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=L,_e.useSetupDone=F,_e.SetupGuide=function({start:e}){const{rid:s,r:t}=(0,T.useCtx)(6e4),n=F(s),o=n.prog,[a,l]=(0,c.useState)(e??null);if(a){const e=k.SETUP_STEPS.findIndex(e=>e.id===a),s=k.SETUP_STEPS[e+1]?.id??null;return(0,R.jsx)(A,{id:a,wizard:!0,onBack:()=>l(e>0?k.SETUP_STEPS[e-1].id:null),onClose:()=>l(null),onNext:()=>l(s)})}const r=k.SETUP_STEPS.find(e=>!n.isDone(e.id))?.id??null,i=!r&&!n.loading;return(0,R.jsxs)(g.default,{style:{gap:12},testID:"setup-guide",children:[(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{gap:12,children:[(0,R.jsx)(p.RestaurantLogo,{rid:s,size:56}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsxs)(m.T,{size:20,weight:"bold",colour:C.colours.gold,children:["Set up ",t.name]}),(0,R.jsx)(m.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,R.jsx)(L,{done:o.done,total:o.total,testID:"setup-progress"}),n.loading?null:(0,R.jsx)(m.Button,{label:r?o.done?'Continue setup':'Start setup':'Review setup',kind:i?'ghost':void 0,testID:"setup-continue",onPress:()=>l(r??'venue')})]}),(0,R.jsx)(g.default,{style:{borderRadius:14,borderWidth:1,borderColor:C.colours.border,backgroundColor:C.colours.surface,overflow:'hidden'},children:k.SETUP_STEPS.map((e,s)=>{const t=n.isDone(e.id),o=t?[]:n.missing(e.id);return(0,R.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:C.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:[(0,R.jsx)(g.default,{style:{width:32,height:32,borderRadius:16,alignItems:'center',justifyContent:'center',backgroundColor:t?C.colours.gold:'transparent',borderWidth:1.5,borderColor:t?C.colours.gold:C.colours.border},children:(0,R.jsx)(m.T,{weight:"bold",colour:t?C.colours.onGold:C.colours.muted,children:t?'\u2713':s+1})}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"medium",children:e.title}),(0,R.jsx)(m.Muted,{children:e.sub}),o.length?(0,R.jsxs)(m.T,{size:13,colour:C.colours.amber,children:["Still needed: ",o.join('; ')]}):null]}),t?(0,R.jsx)(m.Badge,{kind:"ok",label:"Done"}):null,(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]},e.id)})})]})},_e.StepFrame=A,Object.defineProperty(_e,"stepPage",{enumerable:!0,get:function(){return V}}),_e.SetupCard=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=F(s),n=t.prog;return t.loading||n.done>=n.total?null:(0,R.jsxs)(m.Card,{onPress:()=>e('more','setup'),highlight:C.colours.gold,children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",colour:C.colours.gold,children:"Finish setting up"}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"\u203a"})]}),(0,R.jsx)(L,{done:n.done,total:n.total,testID:"dash-setup-progress"}),(0,R.jsxs)(m.Muted,{size:13,children:["Next: ",k.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]),x=_r(_d[14]),m=_r(_d[15]),b=_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]),z=_r(_d[27]),E=_r(_d[28]),M=_r(_d[29]),R=_r(_d[30]);const I=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],$=[1,2,3,4,5,6,0],B=/^([01]\d|2[0-3]):[0-5]\d$/,D=e=>{const s=(0,M.parseMoneyInput)(e);return null!=s&&s>0?Math.round(100*s):null},O=e=>k.SETUP_STEPS.findIndex(s=>s.id===e)+1;function L({done:e,total:s,testID:t}){const o=s?e/s:0;return(0,R.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,R.jsx)(g.default,{style:{height:10,borderRadius:5,backgroundColor:(0,n.soutersSurface)('#1F1C17'),overflow:'hidden',borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(g.default,{style:{width:`${Math.round(100*o)}%`,height:'100%',backgroundColor:C.colours.gold,borderRadius:5}})}),(0,R.jsxs)(m.Muted,{size:12,children:[e," of ",s," steps done"]})]})}function F(e){const s=(0,k.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=k.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:k.SETUP_STEPS.length},loading:o&&!n,fromVenue:!!a}}function A({id:e,wizard:s,onBack:t,onNext:n,onClose:o}){const{rid:a}=(0,T.useCtx)(6e4),l=F(a),r=l.prog,d=(0,i.useLiveVenue)(),u=k.SETUP_STEPS.find(s=>s.id===e),[p,x]=(0,c.useState)(null),b=N[e];return(0,R.jsxs)(g.default,{style:{gap:12},testID:`setup-${e}`,children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsxs)(m.T,{size:12,weight:"semibold",colour:C.colours.gold,children:["STEP ",O(e)," OF ",k.SETUP_STEPS.length]}),s&&o?(0,R.jsx)(h.default,{accessibilityRole:"button",onPress:o,hitSlop:10,children:(0,R.jsx)(m.T,{size:13,colour:C.colours.muted,children:"All steps"})}):null]}),(0,R.jsx)(m.T,{size:22,weight:"bold",children:u.title}),(0,R.jsx)(L,{done:r.done,total:r.total})]}),(0,R.jsx)(b,{rid:a,done:(t="Saved.")=>{k.useSetup.getState().markDone(a,e),d&&!1===l.markOf(e)?.done&&i.useSetupMarks.getState().set(d,e,!0),s&&n?n():x(t)},wizard:!!s}),p?(0,R.jsx)(m.Banner,{kind:"success",title:p}):null,(0,R.jsx)(G,{rid:a,id:e,title:u.title,onDone:x}),s?(0,R.jsxs)(m.Row,{gap:10,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Back",onPress:t,style:{flex:1},testID:"setup-back"}),(0,R.jsx)(m.Button,{kind:"ghost",label:"Skip for now",onPress:n,style:{flex:1},testID:"setup-skip"})]}):null]})}const U=({wizard:e,onPress:s,disabled:t,label:n})=>(0,R.jsx)(m.Button,{label:n??(e?'Save and continue':'Save changes'),testID:"setup-save",disabled:t,onPress:s,style:{minHeight:54}});const _=e=>({name:'',job:'',access:'Staff',pay:'grade',gradeId:e,wage:'',noTax:!1,look:null});function W({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,T.useHourly)(),d=(0,k.useSiteSetup)(e),u=(0,k.useSetup)(e=>e.looks),[p,b]=(0,c.useState)(null),[y,f]=(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,S.gbp)(i[e.id])} an hour`:'Hourly rate set'},P=e=>{const s=d.staffGrade[e.id];b({id:e.id,name:e.name,job:e.job,access:(0,k.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}),f(null)},z=!!p?.id&&(E=p.id,w.ROSTER.some(e=>e.id===E));var E;const M=p?D(p.wage):null,I=!!p&&p.name.trim().length>=2&&('grade'!==p.pay||!!p.gradeId)&&('own'!==p.pay||null!=M||z&&!p.wage);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.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,R.jsx)(g.default,{style:{gap:8},children:l.map(e=>(0,R.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?C.colours.gold:C.colours.border,backgroundColor:s?'#1d1a14':C.colours.surface}),children:[(0,R.jsx)(x.StaffAvatar,{id:e.id,size:42}),(0,R.jsxs)(g.default,{style:{flex:1},children:[(0,R.jsx)(m.T,{weight:"semibold",children:e.name}),(0,R.jsxs)(m.Muted,{size:13,children:[a?`Age not recorded \xb7 ${e.job||(0,k.accessOf)(e.level,e.role)} \xb7 `:`${e.job} \xb7 `,v(e),e.noTax?' \xb7 No tax deducted':'']})]}),(0,R.jsx)(m.Badge,{kind:'owner'===e.role?'gold':'manager'===e.role?'blue':'neutral',label:(0,k.accessOf)(e.level,e.role)})]},e.id))}),y?(0,R.jsx)(m.Banner,{kind:"success",title:y}):null,p?(0,R.jsxs)(m.Card,{highlight:C.colours.gold,children:[(0,R.jsx)(m.T,{weight:"semibold",size:18,children:p.id?`Edit ${p.name}`:'New team member'}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{width:84,height:84,borderRadius:42,overflow:'hidden',borderWidth:2,borderColor:C.colours.gold},children:(0,R.jsx)(x.AvatarLook,{look:p.look,id:p.id,name:p.name||'new',size:80})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsx)(m.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,R.jsx)(s.AvatarOptions,{value:null!=p.look&&p.look>=1e3?t.AVATAR_OPTIONS.find(e=>e.look===p.look)?.dataUrl:void 0,onSelect:e=>b({...p,look:e.look})}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Try another look",testID:"avatar-next",onPress:()=>b({...p,look:((p.look??0)+1)%40})}),null!=p.look?(0,R.jsx)(m.Button,{small:!0,kind:"ghost",label:"Default look",onPress:()=>b({...p,look:null})}):null]})]})]}),z?(0,R.jsxs)(m.Muted,{children:[p.name," is on your roster: name and access stay as they are."]}):(0,R.jsx)(m.Field,{label:"Name",value:p.name,onChangeText:e=>b({...p,name:e}),placeholder:"First and last name"}),(0,R.jsx)(m.Field,{label:"Job title",value:p.job,onChangeText:e=>b({...p,job:e}),placeholder:"e.g. Kitchen porter"}),z?null:(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Access level"}),(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:k.ACCESS_LEVELS.map(e=>(0,R.jsx)(m.Chip,{label:e,selected:p.access===e,onPress:()=>b({...p,access:e})},e))}),(0,R.jsxs)(m.Muted,{size:13,children:["Uses the ",k.ACCESS_APP[p.access]," app. Change what each level can do in Permissions."]})]}),(0,R.jsxs)(g.default,{style:{gap:6},children:[(0,R.jsx)(m.T,{size:14,weight:"medium",colour:C.colours.muted,children:"Pay"}),(0,R.jsxs)(m.Row,{gap:6,wrap:!0,children:[a?null:(0,R.jsx)(m.Chip,{label:"Pay grade",selected:'grade'===p.pay,onPress:()=>b({...p,pay:'grade'})}),(0,R.jsx)(m.Chip,{label:"Own hourly rate",selected:'own'===p.pay,onPress:()=>b({...p,pay:'own'})}),(0,R.jsx)(m.Chip,{label:"Salaried / no hourly wage",selected:'salaried'===p.pay,onPress:()=>b({...p,pay:'salaried'})})]}),'grade'!==p.pay||a?null:(0,R.jsx)(m.Row,{gap:6,wrap:!0,children:d.grades.map(e=>(0,R.jsx)(m.Chip,{label:`${e.name} \xb7 ${(0,S.gbp)(e.pence)}`,selected:p.gradeId===e.id,onPress:()=>b({...p,gradeId:e.id})},e.id))}),'own'===p.pay?(0,R.jsx)(m.Field,{money:!0,label:"\xa3 per hour",value:p.wage,onChangeText:e=>b({...p,wage:e}),keyboardType:"decimal-pad",placeholder:z?'Leave blank to keep their current rate':'e.g. 12.71'}):null,'own'===p.pay&&null!=M&&M<1271?(0,R.jsx)(m.Muted,{size:13,children:"Below \xa312.71: only right for under-21s or apprentices on the correct rate."}):null]}),(0,R.jsx)(m.Toggle,{label:"No tax deducted",value:p.noTax,onChange:e=>b({...p,noTax:e})}),(0,R.jsxs)(m.Row,{gap:8,children:[(0,R.jsx)(m.Button,{kind:"secondary",label:"Cancel",onPress:()=>b(null),style:{flex:1}}),(0,R.jsx)(m.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(),k.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};z||Object.assign(n,{name:p.name.trim(),level:p.access,role:k.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!=M&&s.setRate(t,M);'salaried'===p.pay&&j.useOwner.setState(e=>{const s={...e.hourly};return delete s[t],{hourly:s}}),k.useSetup.getState().patch(e,{staffGrade:o}),k.useSetup.getState().setLook(t,p.look),f(`${p.name.trim()} ${p.id?'updated':'added'}.`),b(null)},style:{flex:1}})]}),p.id?null:(0,R.jsx)(m.Muted,{size:12,children:"Nothing is sent to them. Make their invite link in the Staff invite links step."})]}):a?null:(0,R.jsx)(m.Button,{kind:"secondary",label:"Add a team member",testID:"add-staff",onPress:()=>{b(_(d.grades[0]?.id??'')),f(null)}}),(0,R.jsx)(U,{wizard:o,label:o?'Team looks right, continue':'Mark as done',onPress:()=>n('Team step marked as done.')})]})}const N={venue:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),l=(0,p.useBrand)(e),r=(0,k.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Venue name",value:i.name,onChangeText:e=>d({...i,name:e})}),(0,R.jsx)(m.Field,{label:"Address",value:i.address,onChangeText:e=>d({...i,address:e}),multiline:!0,placeholder:"Street, town, postcode"}),(0,R.jsx)(m.Field,{label:"Phone",value:i.phone,onChangeText:e=>d({...i,phone:e}),keyboardType:"phone-pad"}),(0,R.jsx)(m.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,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Logo"}),(0,R.jsxs)(m.Row,{gap:14,children:[(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:14,padding:8,borderWidth:1,borderColor:C.colours.border},children:(0,R.jsx)(p.RestaurantLogo,{rid:e,size:72})}),(0,R.jsxs)(g.default,{style:{flex:1,gap:6},children:[(0,R.jsxs)(m.Muted,{children:[l.custom?'Your uploaded logo.':(0,y.builtInLogoCopy)(e)," Square images work best. Shown in all five apps and on the Display screensaver."]}),(0,R.jsxs)(m.Row,{gap:8,wrap:!0,children:[(0,R.jsx)(m.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,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Use the built-in logo",onPress:()=>j.useOwner.getState().setBranding(e,{logoUri:void 0})}):null]})]})]})]}),(0,R.jsx)(z.OrderAtTableCard,{rid:e,compact:!0}),u?(0,R.jsx)(m.Banner,{kind:"warn",title:u}):null,(0,R.jsx)(U,{wizard:t,onPress:()=>{i.name.trim().length<2?h('Add your venue\u2019s name.'):!i.email.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.email.trim())?(b.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,T.useCtx)(6e4),[n,a]=(0,c.useState)(t.kitchenHours),l=$.filter(e=>{const s=n[e];return s&&(!B.test(s[0])||!B.test(s[1]))});return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Muted,{children:"Kitchen hours, used for online bookings, takeaway slots and the Display timeline. Use 24-hour times, like 12:00 and 21:00."}),I.map((e,s)=>{const t=$[s],l=n[t];return(0,R.jsxs)(g.default,{style:{width:'100%',minWidth:0,gap:8,minHeight:52,borderTopWidth:s?1:0,borderTopColor:C.colours.border,paddingTop:s?6:0},children:[(0,R.jsx)(m.T,{center:!0,weight:"medium",style:{width:'100%'},children:e}),l?(0,R.jsxs)(m.Row,{wrap:!0,gap:6,style:{width:'100%',justifyContent:'center'},children:[(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} opens`,value:l[0],onChangeText:e=>a({...n,[t]:[e,l[1]]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]}),(0,R.jsx)(m.T,{colour:C.colours.muted,children:"to"}),(0,R.jsx)(o.TextInput,{accessibilityLabel:`${e} closes`,value:l[1],onChangeText:e=>a({...n,[t]:[l[0],e]}),style:[m.styles.input,{flex:1,paddingVertical:8,textAlign:'center'}]})]}):(0,R.jsx)(m.Muted,{style:{flex:1},children:"Closed"}),(0,R.jsx)(m.Toggle,{label:`Open on ${e}`,value:!!l,onChange:e=>a({...n,[t]:e?['12:00','21:00']:null})})]},e)}),n[1]?(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:"Copy Monday\u2019s hours to every open day",onPress:()=>{const e=n[1];e&&a(Object.fromEntries($.map(s=>[s,n[s]?[e[0],e[1]]:null])))}}):null]}),l.length?(0,R.jsx)(m.Banner,{kind:"warn",title:"Check the times",children:"Use 24-hour times like 12:00 or 21:30."}):null,(0,R.jsx)(U,{wizard:s,disabled:!!l.length,onPress:()=>{b.useStore.getState().updateRestaurant(t.id,{kitchenHours:n}),e('Opening hours saved.')}})]})},plan:function({rid:e,done:s,wizard:t}){const n=(0,f.usePlan)(e),o=(0,f.planCounts)(n);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(P.TablePlan,{startStep:"areas"}),(0,R.jsx)(U,{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,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsx)(W,{...e,payList:!0})]})},staff:W,permissions:function({done:e,wizard:s}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(E.PermissionsScreen,{}),(0,R.jsx)(U,{wizard:s,onPress:()=>e('Permissions checked.')})]})},email:function({rid:e,done:s,wizard:t}){const n=(0,k.useSiteSetup)(e),[o,a]=(0,c.useState)(n.email||''),l=!o.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim());return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.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,R.jsx)(m.Muted,{size:13,children:"That doesn\u2019t look like an email address."}),(0,R.jsx)(m.Muted,{children:"Used for the Gmail quick link and shown to guests as your contact email."})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Link your inbox"}),(0,R.jsx)(m.Badge,{kind:"amber",label:"Coming soon"})]}),(0,R.jsx)(m.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,R.jsx)(m.Button,{kind:"secondary",label:"Link email (coming soon)",disabled:!0,onPress:()=>{}})]}),(0,R.jsx)(U,{wizard:t,disabled:!l,onPress:()=>{b.useStore.getState().updateRestaurant(e,{contactEmail:o.trim()}),s('Email saved.')}})]})},website:function({rid:e,done:s,wizard:t}){const{r:o}=(0,T.useCtx)(6e4),a=(0,k.useSiteSetup)(e),[l,r]=(0,c.useState)(a.website||o.website||''),i=(0,c.useMemo)(()=>(0,v.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,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.Field,{label:"Your website",value:l,onChangeText:r,placeholder:"e.g. www.yourvenue.co.uk",keyboardType:"url",autoCapitalize:"none",autoCorrect:!1}),p?null:(0,R.jsx)(m.Muted,{size:13,children:"Enter a web address like www.yourvenue.co.uk"})]}),(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{weight:"semibold",children:"Your booking link"}),(0,R.jsx)(m.Muted,{children:"Add a \u201cBook a table\u201d button to your website that opens this link. Guests book straight into CoverCharge."}),(0,R.jsx)(g.default,{style:{backgroundColor:(0,n.soutersSurface)('#000'),borderRadius:10,borderWidth:1,borderColor:C.colours.border,padding:10},children:(0,R.jsx)(m.T,{size:14,colour:C.colours.goldLight,children:i})}),(0,R.jsx)(m.Button,{small:!0,kind:"secondary",label:d?'Copied \u2713':'Copy booking link',onPress:async()=>{const e=await(0,v.copyText)(i);u(e)}})]}),['anchorage','6349aa07-3fec-46e9-8c69-7b1b08494793'].includes(e)?null:(0,R.jsxs)(m.Card,{children:[(0,R.jsx)(m.T,{center:!0,weight:"semibold",children:"Website bookings tables"}),(0,R.jsx)(m.Row,{wrap:!0,style:{justifyContent:'center'},children:(0,R.jsx)(m.Badge,{kind:"gold",label:"Coming soon"})}),(0,R.jsx)(m.Muted,{center:!0,children:"Coming soon: show live table availability and take bookings right inside your website."})]}),(0,R.jsx)(U,{wizard:t,disabled:!p,onPress:()=>{b.useStore.getState().updateRestaurant(o.id,{website:h||void 0}),k.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,T.useCtx)(6e4),a='owner'===o||'manager'===o?o:'staff';return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m.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,R.jsxs)(m.Card,{children:[(0,R.jsx)(u.StaffLinkChip,{m:e,actorRole:a}),(0,R.jsx)(d.InviteLinkControls,{m:e,actorRole:a})]},e.id)),(0,R.jsx)(U,{wizard:t,label:t?'Finish setup':'Mark as done',onPress:()=>s('Invite links step marked as done.')})]})}},V=e=>function(){return(0,R.jsx)(A,{id:e})};function G({rid:e,id:s,title:t,onDone:n}){const o=F(e),a=(0,i.useLiveVenue)(),l=o.markOf(s),[r,d]=(0,c.useState)(!1);return o.isDone(s)?(0,R.jsxs)(g.default,{style:{gap:4},children:[(0,R.jsx)(m.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),k.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,R.jsx)(m.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,R.jsxs)(m.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}},1449,[888,887,813,812,1039,1450,1451,1452,1453,1455,17,385,85,857,884,777,858,876,1456,998,886,878,851,804,1057,1457,1460,1464,1465,840,8]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.evalSetup=function(s,t){const n=e=>{const s=e.filter(([e])=>!e).map(([,e])=>e);return{done:!s.length,missing:s}};return{venue:n([[s.name,'The venue name'],[s.address,'The address'],[s.phone,'A phone number'],[t.logo,'Your logo']]),hours:n([[s.hoursSet&&s.hoursDays>0,'Kitchen opening hours for at least one day']]),plan:n([[s.planAreas>0,'At least one area'],[s.planTables>0,'Tables on the plan']]),paygrades:n([[s.payGrades>0,'At least one pay grade']]),staff:n([[s.staffActive>0,'At least one person on the team']]),permissions:n([[s.roles>0&&s.rolesWithPerms>0,'What each access level can do']]),email:n([[s.email||/\S+@\S+\.\S+/.test(t.email),'A work email address']]),website:n([[s.website,'Your website address']]),invites:n([[s.staffActive>0&&0===s.staffNoAccess,0===s.staffActive?'Add your team first':`${e(s.staffNoAccess,'person has','people have')} no working invite link yet (${s.staffSignedIn} signed in${s.invitesIssued>s.staffSignedIn?"; older links have run out":''})`]])}},Object.defineProperty(_e,"countDone",{enumerable:!0,get:function(){return s}});const e=(e,s,t=`${s}s`)=>`${e} ${1===e?s:t}`;const s=e=>Object.values(e).filter(e=>e.done).length},1450,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useSetupStatus=function(){const n=(0,u.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null),[s,l]=(0,t.useState)(null),[r,c]=(0,t.useState)(0);return(0,t.useEffect)(()=>{if(!n)return void l(null);let t=!1;return(0,u.rpc)('setup_status',{p_venue:n}).then(u=>{t||l(u??null)}).catch(()=>{}),()=>{t=!0}},[n,r]),{status:s,live:!!n,reload:()=>c(t=>t+1)}};var t=_r(d[0]),u=_r(d[1])},1451,[17,899]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSetupMarks",{enumerable:!0,get:function(){return u}}),e.useLiveVenue=s,e.useSetupMarksLoaded=function(){const n=s(),r=u(t=>t.marks);return(0,t.useEffect)(()=>{n&&u.getState().load(n)},[n]),n?r:{}},Object.defineProperty(e,"applyMark",{enumerable:!0,get:function(){return c}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(0,n.create)()((t,n)=>({venue:null,marks:{},load:async n=>{try{const u=await(0,r.rpc)('setup_step_marks',{p_venue:n});t({venue:n,marks:u??{}})}catch{}},set:async(u,s,c)=>{try{const o=await(0,r.rpc)('set_setup_step',{p_venue:u,p_step:s,p_done:c});return t({marks:{...n().marks,[s]:{done:c,by:o?.by,at:o?.at}}}),!0}catch{return!1}}}));function s(){return(0,r.useSync)(t=>t.venueId&&'staff'===t.kind?t.venueId:null)}const c=(t,n)=>(!n||!1!==n.done)&&t},1452,[17,831,899]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1453,[880,812,17,219,366,85,777,1454,899,804,1188,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1454,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"showLinkA11y",{enumerable:!0,get:function(){return m}}),_e.StaffLinkChip=function({m:e,actorRole:s}){const[u,b]=(0,n.useState)(!1),f=(0,l.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage'))||'owner'===s||'manager'===s&&'owner'!==e.role&&!e.ownerAccess;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(t.default,{testID:`link-chip-${e.id}`,accessibilityRole:"button",accessibilityLabel:m(e.name),disabled:!f,onPress:()=>b(!0),style:({pressed:e})=>({minHeight:44,minWidth:44,padding:10,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:1,borderColor:e?c.colours.gold:c.colours.border}),children:(0,h.jsxs)(o.T,{size:14,children:[e.name.split(' ')[0]," app links"]})}),u?(0,h.jsx)(p,{m:e,actorRole:s,onClose:()=>b(!1)}):null]})},_e.InviteLinkSheet=p;var e,n=r(d[0]),s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),h=r(d[6]);const m=e=>`${e.split(' ')[0]}, show Android and iPhone app links`;function p({m:e,actorRole:n="staff",onClose:s}){return(0,h.jsxs)(o.Sheet,{visible:!0,onClose:s,title:`${e.name}'s app links`,testID:"invite-link-sheet",children:[(0,h.jsx)(u.InviteLinkControls,{m:e,actorRole:n}),(0,h.jsx)(o.Button,{kind:"ghost",label:"Close",onPress:s,style:{minHeight:56}})]})}},1455,[17,385,777,899,804,1453,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.builtInLogoCopy=function(o){return'anchorage'===o?'The Anchorage logo in black and gold.':'Placeholder initials.'}},1456,[]); +__d(function(_g,_r,_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,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1457,[812,891,1140,899,780,1230,1232,17,264,362,219,385,85,409,864,777,858,1241,876,851,863,804,1184,1057,853,1055,1446,1161,1458,1459,1139,1146,1145,1008,839,1142,1149,1221,8]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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,{money:!0,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,{money:!0,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})})]})}},1458,[812,17,1228,1026,854,362,385,85,777,876,851,863,804,1184,1057,1221,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1459,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1460,[812,17,1018,378,85,1108,1109,1367,1400,777,995,998,863,804,1057,999,1461,1462,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1461,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1462,[17,85,777,998,1463,842,804,1038,928,8]); +__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):''},1463,[]); +__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."})]})})}},1464,[805,1421,17,85,777,858,876,8]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PermissionsScreen=function(){const[e,r]=(0,s.useState)(null),[t,y]=(0,s.useState)(''),[f,b]=(0,s.useState)('role'),[j,k]=(0,s.useState)('manager'),[x,w]=(0,s.useState)(null),[L,v]=(0,s.useState)(!1),[R,T]=(0,s.useState)(''),$=(0,s.useCallback)(async()=>{try{r(await(0,d.loadPermissions)()),y('')}catch(e){y(e.message)}},[]);(0,s.useEffect)(()=>{$()},[$]);const E=(0,s.useMemo)(()=>(e?.roles??[]).filter(e=>c.ROLE_ORDER.includes(e.key)),[e]),C=E.find(e=>e.key===j),P=e?.staff.find(e=>e.ref===x)??null,S=!!e?.canEdit,O=async(e,s)=>{v(!0),T('');const r=await e();v(!1);const t=r.ok?s:r.error??'Could not save.';T(t),u(t),r.ok&&await $()};if(t)return(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,colour:l.colours.amber,testID:"perm-error",children:t}),(0,h.jsx)(o.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{$()}})]});if(!e)return(0,h.jsx)(o.Muted,{center:!0,children:"Loading permissions\u2026"});const _=(e,s,r,t,d,u)=>c.PERM_GROUPS.map(m=>(0,h.jsxs)(n.default,{style:{width:'100%',marginTop:6},children:[(0,h.jsx)(o.T,{weight:"semibold",colour:l.colours.gold,size:14,center:!0,accessibilityRole:"header",children:m}),c.PERM_CATALOG.filter(e=>e.group===m).map(n=>{const o=e(n.key);return(0,h.jsx)(p,{id:`${u}-${n.key}`,label:n.label,on:o,locked:s(n.key),note:t(n.key),spoken:r(n.key,o),onPress:()=>d(n.key,o)},n.key)})]},m));return(0,h.jsxs)(n.default,{testID:"permissions-screen",style:{gap:12,width:'100%',alignItems:'center'},children:[(0,h.jsx)(o.Muted,{center:!0,children:"Tick what each role can do, or change one person. These are saved for the whole team and the server checks them on every phone and screen."}),S?null:(0,h.jsx)(n.default,{testID:"perm-readonly",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:12,padding:10},children:(0,h.jsx)(o.T,{center:!0,size:14,children:"Only owners can change permissions. You can see them here."})}),(0,d.permissionsLive)()?null:(0,h.jsx)(o.Muted,{center:!0,size:12,testID:"perm-sample",children:"Sample team: connect to the shared team to see and change your own."}),(0,h.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,h.jsx)(o.Chip,{testID:"perm-view-role",label:"By role",selected:'role'===f,onPress:()=>b('role')}),(0,h.jsx)(o.Chip,{testID:"perm-view-person",label:"By person",selected:'person'===f,onPress:()=>b('person')})]}),R?(0,h.jsx)(n.default,{accessibilityLiveRegion:"polite",testID:"perm-msg",children:(0,h.jsx)(o.T,{center:!0,size:15,colour:l.colours.goldLight,children:R})}):null,'role'===f?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:E.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-role-${e.key}`,label:c.ROLE_LABEL[e.key]??e.name,sub:e.owner?'Everything':`${(0,c.ticks)(e.perms).length} of ${c.PERM_KEYS.length}`,selected:j===e.key,onPress:()=>k(e.key)},e.key))}),C?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:c.ROLE_LABEL[C.key]??C.name}),C.owner?(0,h.jsx)(o.Muted,{center:!0,children:"Owners can always do everything. This can\u2019t be changed."}):(0,h.jsx)(o.Muted,{center:!0,size:13,children:"Everyone with this role gets these ticks, unless you change them for one person."}),_(e=>(0,c.has)(C.perms,e),()=>C.owner||!S||L,(e,s)=>`${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}.`,e=>c.PERM_CATALOG.find(s=>s.key===e)?.note,(e,s)=>{O(()=>(0,d.saveRolePerms)(C.key,(0,c.toggle)((0,c.ticks)(C.perms),e,!s)),`${s?'Taken off':'Ticked'} for every ${c.ROLE_LABEL[C.key]??C.name}: ${(0,c.permLabel)(e)}. Saved.`)},'perm')]}):null]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,h.jsx)(o.Chip,{testID:`perm-person-${e.ref}`,label:m(e.name),sub:c.ROLE_LABEL[e.role]??e.role,selected:x===e.ref,accessibilityLabel:`${e.name}, ${g(e)}`,onPress:()=>w(e.ref)},e.ref))}),P?(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,size:18,weight:"bold",colour:l.colours.gold,accessibilityRole:"header",children:P.name}),(0,h.jsx)(o.T,{center:!0,size:14,colour:l.colours.muted,testID:"perm-person-facts",children:g(P)}),(0,h.jsx)(o.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:P.extra.length||P.removed.length?(0,h.jsx)(o.Badge,{kind:"gold",label:"Changed just for them"}):(0,h.jsx)(o.Badge,{label:"Same as their role"})}),(0,c.ownerLevel)(P.base)?(0,h.jsx)(o.Muted,{center:!0,children:'owner'===P.role?'Owners can always do everything.':'Temporary owner access: everything. Only an owner can change this, in Staff & roles.'}):null,_(e=>(0,c.has)(P.effective,e),()=>(0,c.ownerLevel)(P.base)||!S||L||P.ref===e.me,(e,s)=>{const r=(0,c.tickSource)(P,e);return`${m(P.name)}: ${(0,c.permLabel)(e)}. ${s?'Ticked':'Not ticked'}${'off'===r?'':`, ${c.SOURCE_WORDS[r]}`}.`},e=>{const s=(0,c.tickSource)(P,e);return'extra'===s||'removed'===s?c.SOURCE_WORDS[s]:'takings.view'===e&&P.cashUp&&!(0,c.has)(P.effective,e)?'Can use cash up: tonight\u2019s cash up only':void 0},(e,s)=>{O(()=>(0,d.savePersonPerms)(P.ref,(0,c.toggle)((0,c.ticks)(P.effective),e,!s)),`${s?'Taken off':'Ticked'} for ${m(P.name)}: ${(0,c.permLabel)(e)}. Saved.`)},'perm-p'),P.ref===e.me?(0,h.jsx)(o.Muted,{center:!0,size:13,children:"You can\u2019t change your own permissions."}):null,S&&(P.extra.length||P.removed.length)?(0,h.jsx)(o.Button,{small:!0,kind:"secondary",testID:"perm-reset",label:"Back to their role",accessibilityLabel:`Put ${m(P.name)} back to the ${c.ROLE_LABEL[P.role]??P.role} role's ticks`,disabled:L,onPress:()=>{O(()=>(0,d.savePersonPerms)(P.ref,null),`${m(P.name)} is back to the ${c.ROLE_LABEL[P.role]??P.role} ticks. Saved.`)}}):null,(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Temporary manager, Temporary owner and Can use cash up are switched in Staff & roles."})]}):(0,h.jsx)(o.Muted,{center:!0,children:"Pick someone to see exactly what they can do."})]}),(0,h.jsxs)(o.Card,{children:[(0,h.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Changes"}),e.log.length?e.log.slice(0,8).map(e=>(0,h.jsxs)(n.default,{testID:"perm-log-row",accessible:!0,accessibilityLabel:`${(0,c.logWhen)(e.at)}. ${(0,c.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{width:'100%',paddingVertical:6,borderTopWidth:1,borderTopColor:l.colours.border,alignItems:'center'},children:[(0,h.jsx)(o.T,{center:!0,size:14,children:(0,c.logWords)(e)}),(0,h.jsxs)(o.Muted,{center:!0,size:12,children:[(0,c.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,h.jsx)(o.Muted,{center:!0,children:"No changes yet."}),(0,h.jsx)(o.Muted,{center:!0,size:12,children:"Every change keeps who made it, when, and what it was before."})]})]})};var s=_r(_d[0]),r=e(_r(_d[1])),t=e(_r(_d[2])),n=e(_r(_d[3])),o=_r(_d[4]),l=_r(_d[5]),c=_r(_d[6]),d=_r(_d[7]),h=_r(_d[8]);const u=e=>{try{r.default.announceForAccessibility?.(e)}catch{}},m=e=>e.split(' ')[0];function p({id:e,label:s,on:r,locked:c,note:d,spoken:u,onPress:m}){return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"checkbox",accessibilityState:{checked:r,disabled:c},"aria-checked":r,accessibilityLabel:u,disabled:c,onPress:m,style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:52,width:'100%',borderTopWidth:1,borderTopColor:l.colours.border,opacity:c&&!r?.6:1},children:[(0,h.jsx)(n.default,{style:{width:28,height:28,borderRadius:7,borderWidth:2,borderColor:r?l.colours.gold:l.colours.muted,backgroundColor:r?l.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:r?(0,h.jsx)(o.T,{weight:"bold",colour:l.colours.onGold,children:"\u2713"}):null}),(0,h.jsxs)(n.default,{style:{flex:1,paddingVertical:6},children:[(0,h.jsx)(o.T,{size:15,children:s}),d?(0,h.jsx)(o.Muted,{size:12,children:d}):null]})]})}function g(e){const s=[c.ROLE_LABEL[e.role]??e.role];return e.ownerAccess&&s.push('temporary owner access'),e.managerAccess&&s.push('temporary manager access'),e.cashUp&&!(0,c.has)(e.effective,'takings.view')?s.push('cash up: tonight only'):(e.cashUp||(0,c.has)(e.effective,'wages.manage'))&&s.push('cash up'),s.join(' \xb7 ')}},1465,[17,264,385,85,777,804,915,1466,8]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"permissionsLive",{enumerable:!0,get:function(){return f}}),e.loadPermissions=async function(){if(!f())return JSON.parse(JSON.stringify(u()));const{data:r,error:n}=await o().rpc('permissions_get',{p_venue:a.useSync.getState().venueId});if(n)throw new Error(/Only owners and managers/i.test(n.message)?'Only owners and managers can see permissions.':'Could not load the permissions. Try again.');const s=r;return{catalog:s.catalog??[...t.PERM_KEYS],canEdit:!!s.canEdit,me:s.me??null,roles:s.roles??[],staff:s.staff??[],log:s.log??[]}},e.saveRolePerms=async function(r,n,s){if(!f()){const a=u(),o=a.roles.find(a=>a.key===r);if(!o||o.owner)return{ok:!1,error:'Owners always have full access.'};const f=o.perms;return o.perms=[...n].sort(),a.staff.filter(a=>a.role===r).forEach(r=>{r.base=[...new Set([...o.perms,...r.managerAccess?m:[]])].sort(),r.effective=(0,t.effectivePerms)(r.base,r.extra,r.removed)}),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'role',target_ref:r,target_name:o.name,before:f,after:o.perms,reason:s??'Permissions screen'}),{ok:!0}}const{error:c}=await o().rpc('permissions_set_role',{p_venue:a.useSync.getState().venueId,p_role_key:r,p_perms:n,p_reason:s??null});return c?{ok:!1,error:p(c.message)}:{ok:!0}},e.savePersonPerms=async function(r,n,s){if(!f()){const a=u(),o=a.staff.find(a=>a.ref===r);if(!o)return{ok:!1,error:'Unknown staff member'};if('owner'===o.role)return{ok:!1,error:'Owners always have full access.'};const f={extra:o.extra,removed:o.removed};return null==n?(o.extra=[],o.removed=[]):(o.extra=n.filter(r=>!o.base.includes(r)).sort(),o.removed=o.base.filter(r=>t.PERM_KEYS.includes(r)&&!n.includes(r)).sort()),o.effective=(0,t.effectivePerms)(o.base,o.extra,o.removed),a.log.unshift({id:`d${Date.now()}`,at:(new Date).toISOString(),changed_by_name:'You',target_kind:'staff',target_ref:r,target_name:o.name,before:f,after:{extra:o.extra,removed:o.removed},reason:s??'Permissions screen'}),{ok:!0}}const{error:m}=await o().rpc('permissions_set_staff',{p_venue:a.useSync.getState().venueId,p_staff_ref:r,p_perms:n,p_reason:s??null});return m?{ok:!1,error:p(m.message)}:{ok:!0}};var r=_r(_d[0]),a=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),t=_r(_d[4]);const o=()=>(0,r.getSupabase)(),f=()=>{const r=a.useSync.getState();return'staff'===r.kind&&!!r.venueId&&'off'!==r.mode&&'local'!==r.mode},m=['attendance.view','bookings.manage','floor.manage','rota.swap','shift.manager','stock.manage'],c=['bookings.manage','devices.manage','floor.manage','orders.manage','outbox.view','recipes.edit','recipes.signoff','rota.manage','staff.manage','stock.manage','suppliers.manage','suppliers.order','takings.view','venue.settings','wages.manage','wages.view'];let l=null;const d=(r,a)=>'owner'===r?'owner':'Head Chef'===a?'head_chef':'Supervisor'===a?'supervisor':'manager'===r?'manager':'staff';function u(){if(l)return l;const r=[{key:'owner',name:'Owner',owner:!0,perms:['*']},{key:'manager',name:'Manager',owner:!1,perms:[...c]},{key:'supervisor',name:'Supervisor',owner:!1,perms:[...c]},{key:'head_chef',name:'Head Chef',owner:!1,perms:['orders.manage','recipes.edit','recipes.signoff','stock.manage','suppliers.manage','suppliers.order']},{key:'staff',name:'Staff',owner:!1,perms:[]}],a=n.useOwner.getState().staff.filter(r=>r.active&&!r.temp).map(a=>{const n='st-finn'===a.id||'st-agate'===a.id,s=!!a.managerAccess||n,o=n||s&&'manager'===a.role?'staff':a.role,f=d(o,a.level),l=r.find(r=>r.key===f)?.perms??[],u=[...new Set([...l,...s?m:[],...a.ownerAccess?['*',...c]:[]])].sort(),p=n?['bookings.settings']:[],w=n?['rota.swap']:[];return{ref:a.id,name:a.name.replace(' (example)',''),role:f,app:'head_chef'===f?'chef':'staff'===f?'staff':'owner',managerAccess:s,ownerAccess:!!a.ownerAccess,cashUp:n,extra:p,removed:w,base:u,effective:(0,t.effectivePerms)(u,p,w)}}).sort((r,a)=>r.name.localeCompare(a.name)),o=r=>new Date(Date.now()-36e5*r).toISOString(),f=[{id:'l2',at:o(2),changed_by_name:'Admin',target_kind:'role',target_ref:'manager',target_name:'Manager',before:c.filter(r=>'takings.view'!==r),after:c,reason:'Takings split from wages (same access as before)'},{id:'l1',at:o(2.1),changed_by_name:'Admin',target_kind:'staff',target_ref:'st-finn',target_name:a.find(r=>'st-finn'===r.ref)?.name??'Finn',before:null,after:{extra:['bookings.settings'],removed:['rota.swap']},reason:'Moved from the built-in preset (same access as before)'}];return l={catalog:[...t.PERM_KEYS],canEdit:'owner'===s.APP_VARIANT&&!s.IS_CAR,me:n.useOwner.getState().staffAs??null,roles:r,staff:a,log:f},l}const p=r=>/Only an owner/i.test(r)?'Only an owner can change permissions.':/own permissions/i.test(r)?'You can\u2019t change your own permissions.':/Owners always/i.test(r)?'Owners always have full access.':/owner access/i.test(r)?'Only an owner can change the permissions of someone with owner access.':'Could not save. Try again.'},1466,[928,899,876,856,915]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHTS_PLAN_LABEL",{enumerable:!0,get:function(){return P}}),_e.useInsightsAccess=S,_e.SuperProInsights=_,_e.SuperProInsightsPage=function({go:e}){return S().any?(0,D.jsx)(o.default,{style:{alignItems:'center',width:'100%'},testID:"superpro-insights-page",children:(0,D.jsx)(_,{go:e})}):(0,D.jsx)(E,{})},_e.InsightsSalesPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.sales)return(0,D.jsx)(E,{});const r=i.sales;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-sales-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:6,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Last 7 days"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,children:null!=r.last7?(0,x.moneyGbp)(r.last7):'\u2014'}),r.missing7?(0,D.jsx)(l.Muted,{center:!0,children:`From ${r.days7} of ${r.days7+r.missing7} cash ups. ${r.missing7} ha${1===r.missing7?'s':'ve'} no card or cash total yet, so ${1===r.missing7?'it is':'they are'} not in the total.`}):null,(0,D.jsx)(l.Muted,{center:!0,children:null!=r.prev7?`The 7 days before: ${(0,x.moneyGbp)(r.prev7)}${null!=r.changePct?` (${r.changePct>=0?'up':'down'} ${Math.abs(r.changePct)}%)`:''}`:'Nothing to compare with yet'}),(0,D.jsx)(l.Muted,{center:!0,children:null!=r.sph7?`Spend per head ${(0,x.moneyGbp)(r.sph7)}, on the ${r.sphDays7} day${1===r.sphDays7?'':'s'} with takings and Covers`:'Spend per head shows once days have takings and Covers'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Takings by week"}),(0,D.jsx)(O,{values:r.weeks.map(e=>e.gross),w:300,h:70}),r.weeks.slice().reverse().map(e=>(0,D.jsx)(W,{a:`${(0,w.ukDate)(e.from)} \u2013 ${(0,w.ukDate)(e.to)}`,b:null!=e.gross?`${(0,x.moneyGbp)(e.gross)} \xb7 ${e.days} day${1===e.days?'':'s'} cashed up${e.missing?`, ${e.missing} with no card or cash total`:''}`:e.missing?`Not enough data: ${e.missing} cash up${1===e.missing?'':'s'} with no card or cash total`:'No signed-off cash ups'},e.to)),(0,D.jsx)(l.Muted,{center:!0,children:"Takings are card + cash \u2212 card tips from signed-off cash ups (Gross only for a prepaid function), as in Business insights. A day without a cash up is never counted as \xa30."})]}),(0,D.jsxs)(l.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Business insights",onPress:()=>e('more','bizinsights')}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Spend per head",onPress:()=>e('more','spendhead')})]})]})},_e.InsightsStockPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.stock)return(0,D.jsx)(E,{});const r=i.stock;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-stock-page",children:[(0,D.jsx)(A,{example:i.example}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Low or out now"}),(0,D.jsx)(l.Muted,{center:!0,children:"Live tracked stock (the counts on the Display, Staff and Head Chef apps), at or below each item\u2019s warn-at level."}),r.low.length?r.low.map(e=>(0,D.jsx)(W,{testID:`low-${e.key}`,tone:e.out?k.colours.red:k.colours.amber,a:`${e.name} \xb7 ${e.out?'none left':e.countText}`,b:`Warns at ${e.lowText}`},e.key)):(0,D.jsx)(l.Muted,{center:!0,children:r.tracked?'Nothing low.':'No tracked stock set up yet (Settings \u203a Stock items).'})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:`Price rises in the last ${w.RISE_DAYS} days`}),r.rises.length?r.rises.map(e=>(0,D.jsx)(W,{testID:`rise-${e.ingId}`,a:`${e.name} \xb7 up ${e.pct}%`,b:`${(0,$.gbp)(e.before)} \u2192 ${(0,$.gbp)(e.after)} a pack \xb7 ${(0,w.ukDate)(e.at)}${e.supplier?` \xb7 ${e.supplier}`:''}`},e.ingId)):(0,D.jsx)(l.Muted,{center:!0,children:"No price rises."}),(0,D.jsx)(l.Muted,{center:!0,children:r.lastCount?`Last full stock count ${(0,w.ukDate)(r.lastCount)}.`:'No full stock count yet.'})]}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Deliveries, stock & GP",onPress:()=>e('more','kitchencosts')})]})},_e.InsightsGpPage=function({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t);if(!n.gp)return(0,D.jsx)(E,{});const r=i.gp;return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-gp-page",children:[(0,D.jsx)(A,{example:i.example}),i.example?(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP, last 3 months"}),(0,D.jsx)(l.T,{size:30,weight:"bold",center:!0,colour:k.colours.gold,children:L(r.menu)}),null!=r.startMenu&&null!=r.menu?(0,D.jsx)(l.Muted,{center:!0,children:`${G(r.menu-r.startMenu)} points since ${(0,w.ukDate)(r.trend[0]?.week??'')}`}):null,(0,D.jsx)(O,{values:r.trend.map(e=>e.menu),w:300,h:80})]}):null!=r.menu?(0,D.jsx)(v.GpOverTime,{rid:s}):(0,D.jsx)(o.default,{testID:"insights-gp-not-enough",style:{width:'100%'},children:(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Menu GP"}),(0,D.jsx)(l.T,{weight:"semibold",center:!0,children:"Not enough data"}),(0,D.jsx)(l.Muted,{center:!0,children:`${r.fullyCosted} of ${r.costed} costed dishes have every recipe ingredient costed. Menu GP shows once ${w.MIN_FULLY_COSTED} or more are, so a part-costed dish cannot make GP look too high.`})]})}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.amber,center:!0,children:"GP fell after a cost change (14 days)"}),r.drops.length?r.drops.map(e=>(0,D.jsx)(W,{testID:`drop-${e.dishId}`,tone:k.colours.amber,a:`${e.dish}: ${L(e.before)} \u2192 ${L(e.after)}`,b:`After the ${e.supplier||'delivery'} prices on ${(0,w.ukDate)(e.date)}`},e.dishId)):(0,D.jsx)(l.Muted,{center:!0,children:"No dish lost GP from a delivery in the last 14 days."})]}),(0,D.jsxs)(l.Card,{style:{alignItems:'center',gap:4,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:"Each dish over 3 months"}),r.dishes.length?r.dishes.map(e=>(0,D.jsx)(W,{a:`${e.name} \xb7 ${L(e.gp)}`,tone:e.gpe('more','kitchencosts')})]})},_e.InsightsClockPage=function({go:e}){const s=S(),n=C(),{list:i,source:r}=N(),[a,d]=(0,t.useState)('all');if(!s.clock)return(0,D.jsx)(E,{});const c='unsigned'===a?i.filter(e=>!1===e.signed):i,u=e=>{const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleString('en-GB',{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};return(0,D.jsxs)(o.default,{style:{gap:12,alignItems:'center'},testID:"insights-clock-page",children:[(0,D.jsx)(A,{example:!!n}),(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center'},children:[(0,D.jsx)(l.Button,{small:!0,kind:'all'===a?'primary':'secondary',label:`All (${i.length})`,onPress:()=>d('all'),testID:"clock-filter-all"}),(0,D.jsx)(l.Button,{small:!0,kind:'unsigned'===a?'primary':'secondary',label:`Not signed off (${i.filter(e=>!1===e.signed).length})`,onPress:()=>d('unsigned'),testID:"clock-filter-unsigned"})]}),(0,D.jsx)(l.Card,{style:{alignItems:'center',gap:2,width:'100%'},children:c.length?c.map(e=>(0,D.jsxs)(o.default,{testID:`clock-change-${e.id}`,accessible:!0,accessibilityLabel:`${w.KIND_WORDS[e.kind]} for ${e.staffName??e.staffRef}, shift ${(0,w.ukDate)(e.workDate)}. ${e.before?`Before ${e.before}. `:''}${e.after?`After ${e.after}. `:''}By ${e.by}, ${u(e.at)}.${!1===e.signed?' Not signed off yet.':''}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:!1===e.signed?k.colours.amber:k.colours.text,children:`${e.staffName??e.staffRef} \xb7 shift ${(0,w.ukDate)(e.workDate)}`}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,children:`${w.KIND_WORDS[e.kind]}${e.before||e.after?`: ${e.before??'\u2014'} \u2192 ${e.after??'\u2014'}`:''}`}),(0,D.jsx)(l.Muted,{center:!0,children:`By ${e.by} \xb7 ${u(e.at)}${e.reason?` \xb7 \u201c${e.reason}\u201d`:''}`}),!1===e.signed?(0,D.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}):e.signed?(0,D.jsx)(l.Badge,{kind:"gold",label:"Signed off since"}):null]},e.id)):(0,D.jsx)(l.Muted,{center:!0,children:`No clock-in changes in the last ${w.CLOCK_DAYS} days.`})}),(0,D.jsx)(l.Muted,{center:!0,children:'server'===r?'From the server\u2019s timesheet audit.':'synced'===r?'From the timesheet audit on your synced hours.':'Example figures.'}),(0,D.jsx)(l.Button,{small:!0,kind:"secondary",label:"Sign off hours",onPress:()=>e('more','signoff')})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),o=e(_r(_d[3])),i=_r(_d[4]),r=e(i),l=_r(_d[5]),a=_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]),f=_r(_d[13]),y=_r(_d[14]),$=_r(_d[15]),x=_r(_d[16]),w=_r(_d[17]),b=_r(_d[18]),k=_r(_d[19]),j=_r(_d[20]),v=_r(_d[21]),I=_r(_d[22]),D=_r(_d[23]);const P='SuperPro';function S(){const{role:e}=(0,j.useCtx)(6e4),s=(0,j.useSignedIn)(),t=(0,j.useInStaffApp)();return(0,w.insightsAccess)({viewRole:e,signed:s,live:(0,b.isLive)(),inStaffApp:t,perm:e=>(0,b.can)(e)})}function C(){return(0,y.useExamples)()&&!(0,b.isLive)()?I.INSIGHTS_SAMPLE:null}function N(){const e=C(),s=(0,h.useOwner)(e=>e.attendance),n=(0,h.useOwner)(e=>e.staff),[o,i]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(e||!(0,b.isLive)())return;let s=!0;return(0,b.readClockChanges)(w.CLOCK_DAYS).then(e=>{s&&e&&i((0,w.clockChangesFromServer)(e))}),()=>{s=!1}},[e]),(0,t.useMemo)(()=>{if(e)return{list:e.clock,source:'example'};const t=e=>e.map(e=>({...e,staffName:e.staffName??n.find(s=>s.id===e.staffRef)?.name?.replace(' (example)','')??e.staffRef}));if(o)return{list:t(o),source:'server'};const i=(0,w.addDaysYmd)((new Date).toISOString().slice(0,10),-w.CLOCK_DAYS);return{list:t((0,w.clockChangesFromAttendance)(s,i)),source:'synced'}},[e,o,s,n])}function M(e){const s=C(),[n,o]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(s||!e||!(0,b.isLive)())return;let t=!0;return(0,b.readLoyaltyInsight)().then(e=>{t&&o(e?(0,w.loyaltyInsight)(e.raw,e.source):null)}),()=>{t=!1}},[s,e]),s?s.loyalty:e&&(0,b.isLive)()?n:null}function T(e,n){const o=C(),i=(0,c.useCashUp)(e=>e.cashUps),r=(0,c.useCashUp)(e=>e.sales),l=(0,a.useBookings)(e),y=(0,a.useOrders)(e),$=(0,d.useReviews)(e=>e.reviews),x=(0,h.useOwner)(e=>e.attendance),b=(0,j.useHourly)(),k=(0,u.useGpCalcView)(),v=(0,a.useRecipeCards)(e),I=(0,g.useShellStore)(s=>s.items[e]),D=(0,g.useShellStore)((0,f.useShallow)(s=>(0,g.venueCounts)(s,e)));return(0,t.useMemo)(()=>{if(o)return{example:!0,...o};const t=v.map(e=>({id:e.id,dish:e.dish,price:e.price,ingCount:Array.isArray(e.ingredients)?e.ingredients.length:void 0})),a=new Date,d=(0,w.salesInsight)(i,l,e,n,(0,s.coverOverridesFor)(e)),c=x.filter(e=>!e.voided&&'confirmed'===(0,h.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,j.paidMins)(e,a).paid,ratePence:b[e.staffId]??0})),u=x.filter(e=>!e.voided&&'awaiting'===(0,h.attStatus)(e)).map(e=>e.date);return{example:!1,sales:d,stock:(0,w.stockInsight)((I??[]).filter(e=>!e.group),D,(s,t)=>(0,p.fmtStockCount)(e,s,t),k.ingredients,Object.values(k.counts??{}),n),gp:(0,w.gpInsight)(k.ingredients,k.cardCosts??{},t,k.settings,Object.values(k.deliveries??{}),n),bookings:(0,w.bookingsInsight)(l,e,n),orders:(0,w.ordersInsight)(y,e,n),reviews:(0,w.reviewsInsight)($,e,n),labour:(0,w.labourInsight)(c,i,e,n,u),salesReport:(0,w.salesReportInsight)(r,e)}},[o,i,r,l,y,$,x,b,e,n,k,v,I,D])}const L=e=>null==e?'\u2014':`${e.toFixed(1)}%`,G=e=>`${e>0?'+':''}${e.toFixed(1)}`;function O({values:e,w:s=220,h:t=44,testID:n}){const l=e.map((e,s)=>({v:e,i:s})).filter(e=>null!=e.v);if(l.length<2)return null;const a=Math.min(...l.map(e=>e.v)),d=Math.max(...l.map(e=>e.v))-a||1,c=t=>6+t/Math.max(1,e.length-1)*(s-12),u=e=>t-6-(e-a)/d*(t-12),h=l[l.length-1];return(0,D.jsx)(o.default,{testID:n,importantForAccessibility:"no-hide-descendants",accessibilityElementsHidden:!0,style:{alignItems:'center'},children:(0,D.jsxs)(r.default,{width:s,height:t,children:[(0,D.jsx)(i.Polyline,{points:l.map(e=>`${c(e.i).toFixed(1)},${u(e.v).toFixed(1)}`).join(' '),stroke:k.colours.gold,strokeWidth:2.5,fill:"none"}),(0,D.jsx)(i.Circle,{cx:c(h.i),cy:u(h.v),r:3.5,fill:k.colours.gold})]})})}function R({title:e,big:s,line:t,tone:o,onPress:i,testID:r,children:a,a11y:d,plan:c}){return(0,D.jsxs)(n.default,{testID:r,accessibilityRole:"button",accessibilityLabel:d,accessibilityHint:"Opens the detail",onPress:i,style:({pressed:e})=>({flexGrow:1,flexBasis:260,maxWidth:460,minHeight:168,borderRadius:16,borderWidth:1.5,borderColor:o??k.colours.gold,backgroundColor:e?k.colours.goldTint:k.colours.surface,padding:14,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,D.jsx)(l.T,{weight:"semibold",colour:k.colours.gold,center:!0,children:e}),c?(0,D.jsx)(l.T,{size:11,weight:"semibold",colour:k.colours.goldLight,center:!0,children:c.toUpperCase()}):null,(0,D.jsx)(l.T,{size:28,weight:"bold",center:!0,colour:o??k.colours.text,children:s}),(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.muted,children:t}),a,(0,D.jsx)(l.T,{size:k.font.small,center:!0,colour:k.colours.goldLight,children:"Open \u203a"})]})}function A({example:e}){return(0,D.jsxs)(o.default,{style:{alignItems:'center',gap:4},testID:"superpro-insights-head",children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.T,{size:20,weight:"bold",colour:k.colours.gold,center:!0,accessibilityRole:"header",children:"Insights"}),e?(0,D.jsx)(l.Badge,{kind:"neutral",label:"Example figures"}):null]}),(0,D.jsx)(l.Muted,{center:!0,children:"Every figure CoverCharge holds, in one place, from your own records. Owners only."})]})}function B({title:e,sub:s,children:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,style:{gap:8,alignItems:'center',width:'100%'},children:[(0,D.jsxs)(l.Row,{gap:8,style:{justifyContent:'center',alignItems:'center'},children:[(0,D.jsx)(l.Badge,{kind:"gold",label:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]}),(0,D.jsx)(o.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',width:'100%'},children:t})]})}function _({go:e}){const{rid:s,today:t}=(0,j.useCtx)(6e4),n=S(),i=T(s,t),r=N(),l=M(n.loyalty);if(!n.any)return null;const a=(0,w.clockSummary)(r.list),d=(0,w.loyaltyLine)(l),c=s=>e('more',s),u=i.sales,h=i.stock,g=i.gp,p=i.bookings,f=i.orders,y=i.reviews,b=i.labour,v=i.salesReport,I=e=>w.INSIGHT_PLAN[e],C=e=>null==e?'\u2014':(0,x.moneyGbp)(Math.round(e)).replace(/\.00$/,''),_=n.sales||n.stock||n.gp||n.clock,E=n.bookings||n.noshows||n.orders||n.loyalty||n.reviews||n.labour||n.salesReports;return(0,D.jsxs)(o.default,{testID:"superpro-insights",style:{gap:12,alignItems:'center',width:'100%'},children:[(0,D.jsx)(A,{example:i.example}),_?(0,D.jsxs)(B,{testID:"insights-group-superpro",title:P,sub:"Connected EPOS insights",children:[n.sales?(0,D.jsx)(R,{plan:I('sales'),testID:"insight-card-sales",title:"Sales & takings",onPress:()=>c('insights-sales'),big:C(u.last7),line:null==u.last7?u.missing7?`Not enough data: ${u.missing7} cash up${1===u.missing7?'':'s'} in the last 7 days ha${1===u.missing7?'s':'ve'} no card or cash total`:'No signed-off cash ups in the last 7 days':`Last 7 days, card + cash \u2212 card tips from ${u.days7}${u.missing7?` of ${u.days7+u.missing7}`:''} cash-up day${u.days7+u.missing7===1?'':'s'}${u.missing7?` (${u.missing7} with no card or cash total)`:''}${null!=u.changePct?` \xb7 ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)}% on the 7 before`:''}`,a11y:`Sales and takings. ${null!=u.last7?`Last 7 days ${(0,x.moneyGbp)(u.last7)}`:u.missing7?'Not enough data, the cash ups have no card or cash total':'No cash ups yet'}${null!=u.changePct?`, ${u.changePct>=0?'up':'down'} ${Math.abs(u.changePct)} percent`:''}`,children:(0,D.jsx)(O,{testID:"insight-sales-spark",values:u.weeks.map(e=>e.gross)})}):null,n.stock?(0,D.jsx)(R,{plan:I('stock'),testID:"insight-card-stock",title:"Stock",onPress:()=>c('insights-stock'),tone:h.low.length?k.colours.amber:void 0,big:h.low.length?`${h.low.length} low`:h.tracked?'None low':'\u2014',line:`${h.low.length?h.low.slice(0,2).map(e=>`${e.name} ${e.countText}`).join(', '):h.tracked?'Tracked stock above its warn-at levels':'No tracked stock yet'} \xb7 ${h.rises.length} price rise${1===h.rises.length?'':'s'} in ${w.RISE_DAYS} days`,a11y:`Stock. ${h.low.length} tracked items low or out. ${h.rises.length} price rises in ${w.RISE_DAYS} days`}):null,n.gp?(0,D.jsx)(R,{plan:I('gp'),testID:"insight-card-gp",title:"GP & price alerts",onPress:()=>c('insights-gp'),tone:g.drops.length?k.colours.amber:void 0,big:null==g.menu?'\u2014':L(g.menu),line:null==g.menu?`Not enough data: ${g.fullyCosted} of ${g.costed} costed dishes have every ingredient costed`:`Menu GP, ${g.fullyCosted} fully costed dishes${null!=g.startMenu?` \xb7 ${G(g.menu-g.startMenu)} pts in 3 months`:''} \xb7 ${g.drops.length} dish${1===g.drops.length?'':'es'} fell after a cost change`,a11y:`GP. Menu GP ${L(g.menu)}. ${g.drops.length} dishes fell after a cost change`,children:(0,D.jsx)(O,{testID:"insight-gp-spark",values:g.trend.map(e=>e.menu)})}):null,n.clock?(0,D.jsx)(R,{plan:I('clock'),testID:"insight-card-clock",title:"Clock-in changes",onPress:()=>c('insights-clock'),tone:a.unsigned?k.colours.amber:void 0,big:String(a.total),line:`Edits in ${w.CLOCK_DAYS} days \xb7 ${a.unsigned} not signed off yet${a.latest?` \xb7 latest by ${a.latest.by}`:''}`,a11y:`Clock-in changes. ${a.total} edits in ${w.CLOCK_DAYS} days, ${a.unsigned} not signed off`}):null]}):null,E?(0,D.jsxs)(B,{testID:"insights-group-pro",title:"Pro",sub:"Owner dashboard metrics",children:[n.salesReports?(0,D.jsx)(R,{plan:I('salesReports'),testID:"insight-card-salesreports",title:"Weekly sales report",onPress:()=>e('more','cashup'),big:C(v.gross),line:v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}${v.top.length?` \xb7 ${v.top.map(e=>e.name).join(', ')}`:''}`:'No signed-off weekly sales report yet',a11y:"Weekly sales report. "+(v.weekStart?`Week of ${(0,w.ukDate)(v.weekStart)}, ${C(v.gross)}`:'None yet')}):null,n.bookings?(0,D.jsx)(R,{plan:I('bookings'),testID:"insight-card-bookings",title:"Bookings & Covers",onPress:()=>e('more','bizinsights'),big:String(p.covers7),line:`Covers, last 7 days \xb7 ${p.coversPrev7} the 7 before${null!=p.walkInPct?` \xb7 ${p.walkInPct}% walk-ins`:''}`,a11y:`Bookings and Covers. ${p.covers7} Covers in the last 7 days, ${p.coversPrev7} the 7 before`}):null,n.noshows?(0,D.jsx)(R,{plan:I('noshows'),testID:"insight-card-noshows",title:"No-shows & deposits",onPress:()=>e('more','bizinsights'),tone:p.noShows30?k.colours.amber:void 0,big:null!=p.noShowPct?`${p.noShowPct}%`:'\u2014',line:`No-shows, 30 days (${p.noShows30}) \xb7 deposits asked ${p.deposits30.asked}, paid ${p.deposits30.paid}${n.sales?` (${(0,$.gbp)(p.deposits30.paidPence)})`:''}${p.deposits30.waived?`, let off ${p.deposits30.waived}`:''}`,a11y:`No-shows and deposits. No-show rate ${p.noShowPct??'not known'} percent over 30 days. ${p.deposits30.paid} of ${p.deposits30.asked} deposits paid`}):null,n.orders?(0,D.jsx)(R,{plan:I('orders'),testID:"insight-card-orders",title:"Orders & takeaway",onPress:()=>e('more','orders'),big:String(f.count7),line:`Orders, last 7 days \xb7 ${f.takeaway7} takeaway, ${f.table7} table \xb7 ${(0,$.gbp)(f.valuePence7)}`,a11y:`Orders and takeaway. ${f.count7} orders in 7 days, ${f.takeaway7} takeaway`}):null,n.reviews?(0,D.jsx)(R,{plan:I('reviews'),testID:"insight-card-reviews",title:"Reviews",onPress:()=>e('more','reviews'),tone:y.low30?k.colours.amber:void 0,big:null!=y.avg30?`${y.avg30.toFixed(1)} \u2605`:'\u2014',line:`${y.count30} review${1===y.count30?'':'s'} in 30 days \xb7 ${y.low30} at 1 or 2 stars`,a11y:`Reviews. Average ${y.avg30??'none'} stars from ${y.count30} reviews in 30 days`}):null,n.loyalty?(0,D.jsx)(R,{plan:I('loyalty'),testID:"insight-card-loyalty",title:"Loyalty",onPress:()=>e('more','loyalty'),big:d.big,line:d.line,a11y:`Loyalty. ${l?.members??'Not known'} members. ${l?.stampsMonth??'Not known'} stamps this month. ${l?.rewardsMonth??'Not known'} rewards redeemed this month`}):null,n.labour?(0,D.jsx)(R,{plan:I('labour'),testID:"insight-card-labour",title:"Wages & hours vs takings",onPress:()=>e('more','bizinsights'),tone:null!=b.pct7&&b.pct7>35?k.colours.amber:void 0,big:null!=b.pct7?`${b.pct7}%`:'\u2014',line:null!=b.pct7?`Wages of takings on the ${b.days7} day${1===b.days7?'':'s'} with takings, last 7 days \xb7 ${C(b.labour7)} wages`:`Not enough data: no day in the last 7 has both signed-off hours and takings \xb7 ${b.paidHours7} signed-off hours`,a11y:`Wages and hours versus takings. ${b.pct7??'Not known'} percent over 7 days, ${b.paidHours7} hours`}):null]}):null]})}function E(){return(0,D.jsx)(l.Muted,{center:!0,children:"Insights are for owners."})}function W({a:e,b:s,tone:t,testID:n}){return(0,D.jsxs)(o.default,{testID:n,accessible:!0,accessibilityLabel:`${e}. ${s}`,style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:k.colours.border,width:'100%'},children:[(0,D.jsx)(l.T,{weight:"semibold",center:!0,colour:t,children:e}),(0,D.jsx)(l.Muted,{center:!0,children:s})]})}},1467,[1468,17,385,85,780,777,858,1243,1008,905,876,895,897,864,1146,851,1469,1471,899,804,1057,1180,1472,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"coverOverridesFrom",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"coverOverridesFor",{enumerable:!0,get:function(){return c}});var o=r(_d[0]);const t={anchorage:{'2026-11-09':{covers:50,why:'BBC function, prepaid, 50 people (Gordon, 25 Nov 2026)'}}},n=(o,n)=>n?Object.fromEntries(Object.entries(t[o]??{}).map(([o,t])=>[o,t.covers])):{},c=t=>n(t,o.LIVE_VENUE_BUILD)},1468,[822]); +__d(function(_g,_r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.rangeFor=l,_e.previousRange=function(e,n){const o=l(e,n);if('today'===n||'week'===n)return{from:(0,t.addDaysYmd)(o.from,-7*('week'===n?1:0)-('today'===n?1:0)),to:(0,t.addDaysYmd)(o.to,-7*('week'===n?1:0)-('today'===n?1:0))};const[r,s]=o.from.split('-').map(Number),u=`${1===s?r-1:r}-${String(1===s?12:s-1).padStart(2,'0')}-01`,c=(0,t.addDaysYmd)(`${12===s?r+1:r}-${String(12===s?1:s+1).padStart(2,'0')}-01`,-1),d=`${u.slice(0,7)}-${o.to.slice(8,10)}`;return{from:u,to:d<=c&&d>=u?d:c}},_e.changePct=function(t,e){return null==t||null==e||0===e?null:Math.round((t-e)/e*1e3)/10},_e.changeWords=function(t,e){if(null==t)return null;const n='today'===e?'yesterday':'week'===e?'last week':'last month';return 0===t?`No change vs ${n}`:`${t>0?'Up':'Down'} ${Math.abs(t)}% vs ${n}`},_e.canSeeTakingsStats=function(t,e,n){return!('owner'!==t&&'manager'!==t||e&&!n)},_e.coversInRange=function(t,e){let s=0,l=0;for(const u of t){if(!u.date||!n(u.date,e))continue;if(!r(u.status))continue;const t=u.partySize||0;o(u)?s+=t:l+=t}const u=s+l;if(!u)return{total:0,walkIns:0,bookings:0,walkInPct:null,bookingPct:null,empty:!0};const c=Math.round(s/u*100);return{total:u,walkIns:s,bookings:l,walkInPct:c,bookingPct:100-c,empty:!1}},_e.noShowRate=function(t,e,r){const l=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t)&&(s(t.status)||'noshow'===t.status));if(!l.length)return{rate:null,count:0,of:0,empty:!0};const u=l.filter(t=>'noshow'===t.status).length;return{rate:Math.round(u/l.length*1e3)/10,count:u,of:l.length,empty:!1}},_e.cancelRate=function(t,e,r){const s=t.filter(t=>(!r||t.restaurantId===r)&&n(t.date,e)&&!o(t));if(!s.length)return{rate:null,count:0,of:0,empty:!0};const l=s.filter(t=>'cancelled'===t.status).length;return{rate:Math.round(l/s.length*1e3)/10,count:l,of:s.length,empty:!1}},_e.takingsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{gross:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{gross:null,days:0,missing:u.length,missingDates:u}},_e.grossDays=u,_e.tipsInRange=function(e,o,r){let s=0,l=0;const u=[];for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.combinedTips)(c.vals);null!=e?(s+=e,l+=1):u.push(c.date)}return u.sort(),l?{tips:Math.round(100*s)/100,days:l,missing:u.length,missingDates:u}:{tips:null,days:0,missing:u.length,missingDates:u}},Object.defineProperty(_e,"completeTotal",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missingWords",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"takingsMissingWords",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"tipsPctOfTakings",{enumerable:!0,get:function(){return g}}),_e.tipsVsTakings=function(e,o,r){let s=0,l=0,u=0;for(const c of e){if(c.rid!==o||!c.confirmedAt||!n(c.date,r))continue;const e=(0,t.tillTakingsOf)(c.vals),d=(0,t.combinedTips)(c.vals);null==e||null==d||e<=0||(s+=d,l+=e,u+=1)}return u?{pct:g(Math.round(100*s)/100,Math.round(100*l)/100),days:u}:{pct:null,days:0}},_e.spendPerHeadInRange=function(t,n,o,r,s={}){const l=[...u(t,o,r).entries()].map(([t,r])=>({date:t,gross:r,covers:(0,e.coversOn)(n,o,t)+(s[t]??0)})),c=l.filter(t=>t.covers>0),d=l.length-c.length;if(!c.length)return{sph:null,covers:0,gross:null,days:0,noCovers:d};const f=Math.round(100*c.reduce((t,e)=>t+e.gross,0))/100,g=c.reduce((t,e)=>t+e.covers,0);return{sph:Math.round(f/g*100)/100,covers:g,gross:f,days:c.length,noCovers:d}},_e.labourCostInRange=h,_e.labourVsTakings=function(t,e,n,o,r){const s=u(n,o,r),l=s.size?Math.round(100*[...s.values()].reduce((t,e)=>t+e,0))/100:null,c=s.size?h(t,r,s):null;return{pct:m(c,l),labour:c,gross:l,days:s.size,awaiting:e.filter(t=>s.has(t)).length,labourAll:h(t,r)}},Object.defineProperty(_e,"labourPctOfTakings",{enumerable:!0,get:function(){return m}}),_e.repeatGuestPct=function(t,e,o){const r=new Set;for(const n of t){if(o&&n.restaurantId!==o)continue;if(!s(n.status)||n.date>=e.from)continue;const t=p(n);t&&r.add(t)}const l=new Set;let u=0,c=0;for(const d of t){if(o&&d.restaurantId!==o)continue;if(!s(d.status)||!n(d.date,e))continue;const t=p(d);t&&!l.has(t)&&(l.add(t),u+=1,r.has(t)&&(c+=1))}return u?{rate:Math.round(c/u*1e3)/10,count:c,of:u,empty:!1}:{rate:null,count:0,of:0,empty:!0}},_e.firstVisitDate=function(t,e){let n=null;for(const o of t)e&&o.restaurantId!==e||!s(o.status)||!o.date||(!n||o.date(null==t.status||'published'===t.status)&&n(t.createdAt.slice(0,10),e)&&Number.isFinite(t.rating));if(!o.length)return{avg:null,count:0,empty:!0};return{avg:Math.round(o.reduce((t,e)=>t+e.rating,0)/o.length*10)/10,count:o.length,empty:!1}},Object.defineProperty(_e,"NOT_SHOWN_YET",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"UNAVAILABLE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"moneyGbp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ukDay",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"pctLabel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"coversOn",{enumerable:!0,get:function(){return e.coversOn}});var t=_r(_d[0]),e=_r(_d[1]);const n=(t,e)=>t>=e.from&&t<=e.to,o=t=>!!t.walkIn||'walk-in'===t.source,r=t=>'cancelled'!==t&&'noshow'!==t,s=t=>'seated'===t||'finished'===t;function l(e,n){return'today'===n?{from:e,to:e}:'week'===n?{from:(0,t.weekStartOf)(e),to:e}:{from:`${e.slice(0,7)}-01`,to:e}}function u(e,o,r){const s=new Map;for(const l of e){if(l.rid!==o||!l.confirmedAt||!n(l.date,r))continue;const e=(0,t.tillTakingsOf)(l.vals);null!=e&&s.set(l.date,e)}return s}const c=(t,e)=>t.missing?null:e,d=(t,e,n)=>`Not enough data: ${t} cash up${1===t?' has':'s have'} no ${e} yet (${n.map(v).join(', ')})`,f=t=>`${t.length} cash up${1===t.length?' has':'s have'} no card or cash total yet (${t.map(v).join(', ')}), so ${1===t.length?'it is':'they are'} not in the total`,g=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function h(t,e,o){let r=0,s=!1;for(const l of t)!n(l.date,e)||l.ratePence<=0||l.paidMins<=0||o&&!o.has(l.date)||(r+=l.paidMins/60*l.ratePence,s=!0);return s?Math.round(r)/100:null}const m=(t,e)=>null==t||null==e||e<=0?null:Math.round(t/e*1e3)/10;function p(t){const e=(t.phone||'').replace(/\s+/g,'').toLowerCase(),n=(t.email||'').trim().toLowerCase();return e.length>=7?`p:${e}`:n.includes('@')?`e:${n}`:null}const y='Not shown yet: GP and food cost %, table occupancy and top dishes. They need till sales, which CoverCharge does not have yet.',b={weeklyGp:'Weekly GP and food cost need dish sales from a till link. CoverCharge does not have that yet, so no weekly GP is shown.',occupancy:'Table occupancy is not tracked. Busy levels are arrivals per hour, not how full the room was.',topDishes:'Top dishes and sales channels need a till link and are not shown.'},k=t=>null==t?null:`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,w=t=>null==t?null:`${Number.isInteger(t)?String(t):t.toFixed(1)}%`},1469,[839,1470]); +__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,u={}){const l=(0,r.weekStartOf)(o);return Array.from({length:d},(f,h)=>{const m=(0,r.addDaysYmd)(l,7*(h-d+1)),p=i(n,t,s,(0,r.addDaysYmd)(m,6),7,u).filter(r=>r.date<=o&&null!=r.gross),v=p.length?Math.round(100*p.reduce((r,n)=>r+n.gross,0))/100:null,y=p.reduce((r,n)=>r+n.covers,0);return{weekStart:m,gross:v,covers:y,days:p.length,sph:c(v,y)}})},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,l={}){const f=new Map(n.filter(r=>r.rid===s&&r.confirmedAt).map(r=>[r.date,r]));return Array.from({length:i},(n,h)=>{const m=(0,r.addDaysYmd)(o,h-i+1),p=f.get(m)?.vals??{},v=(0,r.tillTakingsOf)(p),y=d(t,s,m)+(l[m]??0),b=u(p.food),k=u(p.drink);return{date:m,gross:v,covers:y,sph:c(v,y),food:b,drink:k,foodPh:c(b,y),drinkPh:c(k,y)}})}const l=(n,t)=>n.some(n=>n.rid===t&&n.confirmedAt&&null!=(0,r.tillTakingsOf)(n.vals))},1470,[839]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"INSIGHT_KEYS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"INSIGHT_PLAN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return a}}),_e.insightsAccess=function(e){if(e.inStaffApp||'owner'!==e.viewRole)return s;if(e.signed){if(a(e.signed))return s;if('owner'!==e.signed.role&&!0!==e.signed.ownerAccess)return s}else if(e.live)return s;const t=t=>!e.live||e.perm(t),n=t('takings.view'),o={sales:n,salesReports:n,gp:n,orders:n,labour:n&&t('wages.view'),stock:t('stock.manage'),clock:t('rota.manage')||t('attendance.view'),bookings:!0,noshows:!0,loyalty:!0,reviews:!0};return{...o,any:r.some(e=>o[e])}},Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return l}}),_e.addDaysYmd=d,Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return c}}),_e.salesInsight=function(e,t,r,o,s={}){const a={from:d(o,-6),to:o},i={from:d(o,-13),to:d(o,-7)},l=(0,n.takingsInRange)(e,r,a),c=(0,n.takingsInRange)(e,r,i),u=(0,n.spendPerHeadInRange)(e,t,r,a,s),f=u.sph,g=[];for(let t=7;t>=0;t--){const s=d(o,-7*t),a=d(s,-6),i=(0,n.takingsInRange)(e,r,{from:a,to:s});g.push({from:a,to:s,gross:i.gross,days:i.days,missing:i.missing})}const p=null!=l.gross&&null!=c.gross&&c.gross>0&&!l.missing&&!c.missing?Math.round((l.gross-c.gross)/c.gross*1e3)/10:null;return{last7:l.gross,prev7:c.gross,changePct:p,days7:l.days,missing7:l.missing,sphDays7:u.days,sph7:f,weeks:g,empty:g.every(e=>null==e.gross)}},Object.defineProperty(_e,"RISE_DAYS",{enumerable:!0,get:function(){return u}}),_e.stockInsight=function(e,t,n,r,o,s){const a=e.filter(e=>e.active),i=a.map(e=>({i:e,n:t[e.key]??0})).filter(({i:e,n:t})=>t<=e.lowAt).map(({i:e,n:t})=>({key:e.key,name:e.plural||e.name,count:t,lowAt:e.lowAt,out:t<=0,countText:n(e,t),lowText:n(e,e.lowAt)})).sort((e,t)=>e.out===t.out?e.count/Math.max(1,e.lowAt)-t.count/Math.max(1,t.lowAt):e.out?-1:1),l=d(s,-30),c=[];for(const e of r){const t=[...e.prices??[]].filter(e=>e.at).sort((e,t)=>e.at.localeCompare(t.at));if(t.length<2)continue;const n=t[t.length-2],r=t[t.length-1];r.p>n.p&&n.p>0&&r.at.slice(0,10)>=l&&c.push({ingId:e.id,name:e.name,before:n.p,after:r.p,pct:Math.round((r.p-n.p)/n.p*1e3)/10,at:r.at.slice(0,10),supplier:e.supplier})}c.sort((e,t)=>t.pct-e.pct);const u=[...o].sort((e,t)=>t.date.localeCompare(e.date))[0];return{low:i,tracked:a.length,rises:c,lastCount:u?.date??null,empty:!a.length&&!c.length&&!u}},Object.defineProperty(_e,"GP_DROP_DAYS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"MIN_FULLY_COSTED",{enumerable:!0,get:function(){return g}}),_e.fullyCostedIds=p,_e.gpInsight=function(n,r,o,s,a,i){const l=p(n,r,o,s),c=o.filter(e=>(r[e.id]?.lines?.length??0)>0).length;if(l.sizel.has(e.id)),f=(0,e.menuGp)(n,r,u,s),m=(0,e.gpHistory)(a,f,'3m',i),h=m.points.find(e=>null!=e.menu)?.menu??null,b=f.dishes.map(e=>{const t=m.points.find(t=>null!=t.dishes[e.id])?.dishes[e.id];return{id:e.id,name:e.name,gp:e.gp,target:e.target,change:null!=t?Math.round(10*(e.gp-t))/10:null}}).sort((e,t)=>(e.change??0)-(t.change??0)),k=(0,t.marginDrops)(a,d(i,-14)).filter(e=>u.some(t=>t.id===e.dishId)).map(e=>({dishId:e.dishId,dish:e.dish,before:e.before,after:e.after,drop:Math.round(10*e.drop)/10,date:e.date,supplier:e.supplier}));return{fullyCosted:l.size,costed:c,menu:f.menu,startMenu:h,trend:m.points.map(e=>({week:e.week,menu:e.menu})),dishes:b,drops:k,underTarget:f.dishes.filter(e=>e.gp=t&&n.push({id:`${r.id}:reclock`,attendanceId:r.id,staffRef:r.staffId,workDate:r.date,kind:'reclock',after:r.in?b(r.in):void 0,by:'Themselves',at:r.in??`${r.date}T00:00:00Z`,signed:!!r.signOff})}return y(n)},_e.clockChangesFromServer=function(e){return y(e.filter(e=>h.has(e.action)||'deleted'===e.action||'reclock'===e.action).map(e=>({id:String(e.id),attendanceId:String(e.attendance_id),staffRef:String(e.staff_ref),staffName:e.staff_name??void 0,workDate:String(e.work_date).slice(0,10),kind:e.action,before:k(e.action,e.old_value),after:k(e.action,e.new_value),by:e.changed_by_name,at:String(e.changed_at),reason:e.reason??void 0,signed:'deleted'===e.action?null:e.signed??null})))},_e.clockSummary=function(e){return{total:e.length,unsigned:e.filter(e=>!1===e.signed).length,people:new Set(e.map(e=>e.staffRef)).size,editors:new Set(e.map(e=>e.by)).size,latest:e[0]??null}},Object.defineProperty(_e,"CLOCK_DAYS",{enumerable:!0,get:function(){return w}}),_e.bookingsInsight=function(e,t,r){const o=e.filter(e=>e.restaurantId===t),s={from:d(r,-6),to:r},a={from:d(r,-13),to:d(r,-7)},i={from:d(r,-29),to:r},l=(0,n.coversInRange)(o,s),c=(0,n.coversInRange)(o,a),u=(0,n.noShowRate)(o,i,t),f=(0,n.cancelRate)(o,i,t),g=o.filter(e=>{const t=e;return'deposit'===t.security&&!!t.date&&t.date>=i.from&&t.date<=i.to});return{covers7:l.total,coversPrev7:c.total,walkInPct:l.walkInPct,noShowPct:u.rate,noShows30:u.count,cancelPct:f.rate,deposits30:{asked:g.length,paid:g.filter(e=>(e.depositPaid??0)>0).length,paidPence:g.reduce((e,t)=>e+(t.depositPaid??0),0),waived:g.filter(e=>!!e.depositWaived).length}}},_e.ordersInsight=function(e,t,n){const r=d(n,-6),o=e.filter(e=>(!e.restaurantId||e.restaurantId===t)&&e.createdAt&&e.createdAt.slice(0,10)>=r&&e.createdAt.slice(0,10)<=n&&'cancelled'!==e.status);return{count7:o.length,takeaway7:o.filter(e=>'takeaway'===e.type).length,table7:o.filter(e=>'table'===e.type).length,valuePence7:o.reduce((e,t)=>e+(t.subtotal||0),0)}},_e.reviewsInsight=function(e,t,r){const o=e.filter(e=>!e.restaurantId||e.restaurantId===t),s={from:d(r,-29),to:r},a=(0,n.reviewAverage)(o,s);return{avg30:a.avg,count30:a.count,low30:o.filter(e=>e.createdAt.slice(0,10)>=s.from&&e.rating<=2).length}},_e.labourInsight=function(e,t,r,o,s=[]){const a={from:d(o,-6),to:o},i=(0,n.labourVsTakings)(e,s,t,r,a),l=e.filter(e=>e.date>=a.from&&e.date<=a.to).reduce((e,t)=>e+t.paidMins,0);return{labour7:i.labour,takings7:i.gross,pct7:i.pct,days7:i.days,paidHours7:Math.round(l/6)/10}},_e.salesReportInsight=function(e,t){const n=e.filter(e=>e.rid===t&&e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0];if(!n)return{weekStart:null,gross:null,top:[]};const r='number'==typeof n.vals.gross?n.vals.gross:null;return{weekStart:n.weekStart,gross:r,top:[...n.categories].sort((e,t)=>t.amount-e.amount).slice(0,3)}},_e.loyaltyInsight=function(e,t){if(!e||'object'!=typeof e)return null;const n=v(e.members),r=v(e.stampsMonth),o=v(e.rewardsUsedMonth??e.rewardsMonth),s=v(e.stampsLastMonthToDate??e.stampsLastMonth);if(null==n&&null==r&&null==o)return null;const a=null!=r&&null!=s&&s>0?Math.round((r-s)/s*1e3)/10:null;return{members:n,stampsMonth:r,stampsLastMonth:s,stampsChangePct:a,rewardsMonth:o,source:t}},_e.loyaltyLine=function(e){const t=e=>null==e?'\u2014':String(e);if(!e)return{big:'\u2014',line:'Members \xb7 stamps this month \u2014 \xb7 rewards redeemed this month \u2014'};const n=null==e.stampsLastMonth?'':` (${t(e.stampsLastMonth)} by this date last month${null==e.stampsChangePct?'':`, ${e.stampsChangePct>0?'up':e.stampsChangePct<0?'down':'level'}${e.stampsChangePct?` ${Math.abs(e.stampsChangePct)}%`:''}`})`;return{big:t(e.members),line:`Members \xb7 stamps this month ${t(e.stampsMonth)}${n} \xb7 rewards redeemed this month ${t(e.rewardsMonth)}`}};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]);const r=['sales','salesReports','gp','stock','clock','bookings','noshows','orders','loyalty','reviews','labour'],o={sales:'SuperPro',gp:'SuperPro',stock:'SuperPro',clock:'SuperPro',salesReports:'Pro',bookings:'Pro',noshows:'Pro',orders:'Pro',loyalty:'Pro',reviews:'Pro',labour:'Pro'},s=Object.fromEntries([...r.map(e=>[e,!1]),['any',!1]]),a=e=>/head chef/i.test(e.level??'')||/head chef/i.test(e.job??'');const i=e=>String(e).padStart(2,'0'),l=e=>`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}`;function d(e,t){const[n,r,o]=e.split('-').map(Number),s=new Date(n,r-1,o);return s.setDate(s.getDate()+t),l(s)}const c=e=>/^\d{4}-\d{2}-\d{2}/.test(e)?`${e.slice(8,10)}/${e.slice(5,7)}`:e;const u=30;const f=14,g=5;function p(e,n,r,o){const s=new Set;for(const a of r){const r=n[a.id];if(!r||!r.lines?.length)continue;if(null==a.ingCount||r.lines.length0||i.priceIsSuggested||s.add(a.id)}return s}const m={clock_in:'Clock-in changed',clock_out:'Clock-out changed',break:'Break changed',added:'Shift added by hand',voided:'Shift removed from hours',unvoided:'Shift put back in hours',deleted:'Shift deleted',reopened:'Signed-off shift reopened',reclock:'Clocked in again after clocking out',request_applied:'Correction request applied'},h=new Set(['clock_in','clock_out','break','added','voided','unvoided','reopened','request_applied']),b=e=>{const t=new Date(e);if(isNaN(t.getTime()))return e;try{return t.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return`${i(t.getHours())}:${i(t.getMinutes())}`}};function k(e,t){if(null!=t&&''!==t)return'clock_in'!==e&&'clock_out'!==e||!/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(t)?'break'===e&&/^\d+$/.test(t)?`${t} min break`:t:b(t.replace(' ','T').replace(/([+-]\d{2})$/,'$1:00'))}const y=e=>e.sort((e,t)=>t.at.localeCompare(e.at));const w=30;const v=e=>'number'==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):null},1471,[908,906,1469]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"INSIGHTS_SAMPLE",{enumerable:!0,get:function(){return t}});const t=null},1472,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAssistantRequestInbox=x,_e.AssistantRequestsButton=function({go:e,testID:t}){const{visible:s,count:l}=x();return s?(0,b.jsx)(n.default,{style:{width:'100%',maxWidth:900,alignSelf:'center',paddingHorizontal:14,paddingTop:4,paddingBottom:8},children:(0,b.jsx)(o.Button,{testID:t??'assistant-requests-btn',label:l?`Assistant requests \xb7 ${l}`:'Assistant requests',accessibilityLabel:(0,p.assistantRequestsButtonLabel)(l),accessibilityHint:"Opens the list of changes your assistant has asked you to confirm or decline",kind:l?'primary':'secondary',onPress:()=>e('more','assistant-requests'),style:{minHeight:56}})}):null},_e.AssistantRequestsPage=function(){const{rows:e,load:t,visible:s}=x();if(!s)return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner can confirm or decline assistant changes, and only when an assistant is paired."})]});return(0,b.jsxs)(n.default,{testID:"assistant-requests-page",style:{gap:12,paddingBottom:24},children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistant requests"}),(0,b.jsx)(o.Muted,{center:!0,children:"Each change waits for an owner to approve or decline it. Important changes ask a second time."}),(0,b.jsx)(w,{rows:e,onChanged:()=>{t()}})]})},_e.AssistantPendingCard=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(null),c=async()=>{try{r(await(0,l.assistantProposalsList)())}catch{r([])}};return(0,t.useEffect)(()=>{if(!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR)return;c();const t=setInterval(()=>{c()},2e4);return()=>clearInterval(t)},[e,s,n]),!e||'owner'!==s||n||'owner'!==u.APP_VARIANT||u.IS_CAR?null:(0,b.jsx)(w,{rows:o,onChanged:()=>{c()},compact:!0})},_e.AssistantsPage=function(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),[s,r]=(0,t.useState)(''),[u,h]=(0,t.useState)(null),[p,x]=(0,t.useState)(!1),[j,v]=(0,t.useState)(null),[A,I]=(0,t.useState)(null),[k,D]=(0,t.useState)(null),[C,S]=(0,t.useState)(null),[T,P]=(0,t.useState)(null),L=async()=>{try{P(await(0,l.assistantAccess)())}catch{P({plan:null,allowed:!1,reason:'Could not check this plan.'})}try{v(await(0,l.assistantList)())}catch{v([])}try{I(await(0,l.assistantProposalsList)())}catch{I([])}try{D(await(0,l.assistantAuditList)())}catch{D([])}};(0,t.useEffect)(()=>{e&&L()},[e]);const R=s.replace(/\D/g,''),$=!!T?.allowed,M=async()=>{x(!0),h(null);const e=await(0,l.assistantApprove)(R);x(!1),e.ok?(r(''),h({ok:!0,text:'Done. The assistant is paired. It can look things up and propose changes, which wait for an owner to confirm on their phone.'}),L()):h({ok:!1,text:e.message})},q=async(e,t)=>{x(!0),h(null);const s=await(0,l.assistantSetEnabled)(e.id,t);x(!1),s.ok?(h({ok:!0,text:t?`${e.label} is switched on.`:`${e.label} is switched off. It stays paired, and you can switch it on again.`}),L()):h({ok:!1,text:s.message})};return(0,b.jsxs)(n.default,{testID:"assistants-page",style:{gap:12},children:[e?(0,b.jsx)(w,{rows:A,onChanged:()=>{L()}}):null,(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Pair your assistant"}),(0,b.jsx)(o.T,{center:!0,children:f}),(0,b.jsx)(o.T,{center:!0,children:"Ask your assistant, such as Grok Bot, to start CoverCharge sign-in. It will show 6 numbers. Only an owner of this venue can approve it. In the connected assistant it can answer questions about your venue and give advice from the data it is allowed to look up. It can propose a change; nothing is changed until an owner confirms it on their phone. Important changes \u2014 permissions, opening hours, the table plan, cancelling or moving a booking, pay, menus, stock or price, online settings, or any delete \u2014 ask a second time, with a plain warning of what is affected."}),!$&&T?(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-plan-blocked",children:T.reason||'Connecting an AI assistant comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.'}):null,(0,b.jsx)(o.Field,{testID:"assistant-code-field",label:"Code shown by the bot (6 numbers)",accessibilityLabel:"Code shown by the bot, 6 numbers",value:s,onChangeText:e=>r(e.replace(/[^\d ]/g,'').slice(0,7)),keyboardType:"number-pad",inputMode:"numeric",autoComplete:"off",autoCorrect:!1,maxLength:7,placeholder:"123 456"}),(0,b.jsx)(o.Button,{testID:"assistant-approve",label:p?'Approving\u2026':'Approve assistant',accessibilityHint:"Pairs your AI assistant with this venue",disabled:!e||!$||p||6!==R.length,onPress:()=>{M()},style:{minHeight:56}}),e?null:(0,b.jsx)(o.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve this."}),(0,b.jsx)(n.default,{accessibilityLiveRegion:"polite",accessible:!!u,accessibilityLabel:u?.text,children:u?(0,b.jsx)(o.T,{testID:"assistant-approve-msg",center:!0,weight:"semibold",colour:u.ok?c.colours.goldLight:c.colours.amber,children:u.text}):null}),(0,b.jsx)(o.Muted,{center:!0,children:"Never send a personal app link to the bot. That link stays on your phone. The bot cannot see sign-in links, PINs or the kitchen unlock code, it cannot read other venues, and it cannot change its own access or pairing."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Assistants paired"}),null===j?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):j.length?j.map(t=>(0,b.jsxs)(n.default,{testID:`assistant-row-${t.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:`${t.label} \xb7 ${!1===t.enabled?'switched off':'paired'}`}),(0,b.jsx)(o.Muted,{center:!0,children:`Since ${y(t.approvedAt)}. Last seen ${y(t.lastSeenAt)}.${t.ownerName?` Tied to ${t.ownerName}.`:''}`}),(0,b.jsx)(o.Toggle,{testID:`assistant-enabled-${t.id}`,label:"Assistant on",value:!1!==t.enabled,disabled:p||!e,onChange:e=>{q(t,e)},a11y:!1===t.enabled?`Switch on ${t.label}`:`Switch off ${t.label}`}),(0,b.jsx)(o.Button,{testID:`assistant-revoke-${t.id}`,kind:"secondary",label:"Unpair this assistant",accessibilityLabel:`Unpair ${t.label}`,onPress:()=>S(t),style:{minHeight:56}})]},t.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No assistant is paired."})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Activity log"}),(0,b.jsx)(o.Muted,{center:!0,children:"Everything this venue\u2019s assistants do is logged here, including look-ups. The assistant cannot change or skip this log."}),null===k?(0,b.jsx)(o.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):k.length?k.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-audit-${e.id}`,style:{gap:2,paddingVertical:8,borderTopWidth:1,borderColor:c.colours.border},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",children:e.detail||e.action}),(0,b.jsx)(o.Muted,{center:!0,children:`${y(e.at)}${e.actorName?` \xb7 ${e.actorName}`:''}`})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,testID:"assistant-audit-empty",children:"No activity yet."})]}),C?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>S(null),title:"Unpair this assistant?",maxWidth:520,testID:"assistant-revoke-confirm",children:[(0,b.jsx)(o.T,{center:!0,children:`${C.label} stops working straight away. Any changes still waiting are cancelled. Your phone is unchanged. To use the bot again, ask it for a new code and approve it here as an owner.`}),(0,b.jsx)(o.Button,{testID:"assistant-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=C;S(null);const t=await(0,l.assistantRevoke)(e.id);h(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),L()},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Cancel",onPress:()=>S(null),style:{minHeight:56}})]}):null]})};var t=_r(d[0]),s=e(_r(d[1])),n=e(_r(d[2])),o=_r(d[3]),l=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]);const y=e=>e?`${(0,r.niceDate)(new Date(e))} at ${(0,r.hm)(new Date(e))}`:'not yet',f='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.';function w({rows:e,onChanged:r,compact:u}){const h=(e??[]).filter(e=>'pending'===e.status),[f,w]=(0,t.useState)(null),[x,j]=(0,t.useState)(null),[v,A]=(0,t.useState)(null),I=async(e,t,n=!1)=>{w(e.id),j(null);const o=await(0,l.assistantProposalDecide)(e.id,t,n);if(w(null),o.ok){A(null);const e='decline'===t?'Declined. Nothing was changed.':'Done. The change has been made.';j(e),s.default.announceForAccessibility(e),r?.()}else j(o.message),s.default.announceForAccessibility(o.message)};return!h.length&&u?null:(0,b.jsx)(n.default,{testID:u?'assistant-pending-home':'assistant-pending-list',children:(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.T,{center:!0,size:18,weight:"semibold",colour:c.colours.goldLight,accessibilityRole:"header",children:"Waiting for an owner to confirm"}),e?h.length?h.map(e=>(0,b.jsxs)(n.default,{testID:`assistant-pending-${e.id}`,style:{gap:8,paddingVertical:10,borderTopWidth:1,borderColor:c.colours.border,alignItems:'center'},children:[(0,b.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:e.summary}),e.needsDoubleConfirm&&e.warning?(0,b.jsxs)(o.Muted,{center:!0,children:["This needs a second confirm. ",e.expiresAt?`Runs out at ${y(e.expiresAt)}.`:'']}):e.expiresAt?(0,b.jsx)(o.Muted,{center:!0,children:`Runs out at ${y(e.expiresAt)}.`}):null,e.canDecide?(0,b.jsxs)(n.default,{style:{gap:8,width:'100%',maxWidth:520,alignSelf:'center'},children:[(0,b.jsx)(o.Button,{testID:`assistant-pending-approve-${e.id}`,label:f===e.id?'Working\u2026':'Approve',accessibilityLabel:(0,p.assistantRequestActionLabel)('Approve',e.summary),accessibilityHint:e.needsDoubleConfirm?'Opens a second confirm step because this change is important':'Applies this change, using your permissions',disabled:!!f,onPress:()=>{e.needsDoubleConfirm?A(e):I(e,'approve')},style:{minHeight:56}}),(0,b.jsx)(o.Button,{testID:`assistant-pending-decline-${e.id}`,kind:"secondary",label:"Decline",accessibilityLabel:(0,p.assistantRequestActionLabel)('Decline',e.summary),disabled:!!f,onPress:()=>{I(e,'decline')},style:{minHeight:56}})]}):(0,b.jsx)(o.Muted,{center:!0,children:"Only an owner of this venue can confirm or decline this on their phone."})]},e.id)):(0,b.jsx)(o.Muted,{center:!0,children:"No changes are waiting."}):(0,b.jsx)(o.Muted,{center:!0,children:"Loading\u2026"}),(0,b.jsx)(n.default,{accessible:!0,accessibilityLiveRegion:"polite",accessibilityRole:"text",testID:"assistant-requests-status",style:{minHeight:x?void 0:0},children:x?(0,b.jsx)(o.T,{testID:"assistant-pending-msg",center:!0,weight:"semibold",colour:c.colours.goldLight,children:x}):null}),v?(0,b.jsxs)(o.Sheet,{visible:!0,onClose:()=>A(null),title:"Please confirm this change",maxWidth:520,testID:"assistant-double-confirm",children:[(0,b.jsx)(o.T,{center:!0,accessibilityRole:"header",children:v.summary}),(0,b.jsx)(o.T,{center:!0,children:"This is an important change to how the venue works. Please read it carefully, then confirm again. Nothing is changed until you do."}),v.warning?(0,b.jsx)(o.Muted,{center:!0,children:v.warning}):null,(0,b.jsx)(o.Button,{testID:"assistant-double-confirm-yes",label:f===v.id?'Working\u2026':'Yes, make this change',disabled:!!f,accessibilityLabel:`Yes, make this change: ${v.summary}`,onPress:()=>{I(v,'approve',!0)},style:{minHeight:56}}),(0,b.jsx)(o.Button,{kind:"secondary",label:"Go back",accessibilityLabel:`Go back without changing: ${v.summary}`,onPress:()=>A(null),style:{minHeight:56}})]}):null]})})}function x(){const e=(0,l.useSync)(e=>'staff'===e.kind&&!!e.venueId),{role:s}=(0,h.useCtx)(3e4),n=(0,h.useInStaffApp)(),[o,r]=(0,t.useState)(0),[c,b]=(0,t.useState)(null),y=async()=>{try{const[e,t]=await Promise.all([(0,l.assistantList)(),(0,l.assistantProposalsList)()]);r((e??[]).length),b(t??[])}catch{r(0),b([])}};(0,t.useEffect)(()=>{if('owner'!==u.APP_VARIANT||u.IS_CAR||n||'owner'!==s||!e)return;y();const t=setInterval(()=>{y()},2e4);return()=>clearInterval(t)},[e,s,n]);const f=(c??[]).filter(e=>'pending'===e.status).length;return{visible:(0,p.canSeeAssistantRequests)({appVariant:u.APP_VARIANT,isCar:u.IS_CAR,inStaffApp:n,role:s,live:e,pairedCount:o}),count:f,rows:c,load:y,paired:o}}},1473,[17,264,85,777,899,863,804,856,1057,1474,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.assistantRequestActionLabel=function(t,s){const n=String(s||'this change').replace(/\s+/g,' ').trim().replace(/\.+$/,'');return`${t}: ${n||'this change'}`},e.assistantRequestsButtonLabel=function(t){const s=Math.max(0,Math.floor(Number(t)||0));return 1===s?'Assistant requests, 1 waiting':`Assistant requests, ${s} waiting`},e.canSeeAssistantRequests=function(t){return'owner'===t.appVariant&&!t.isCar&&!t.inStaffApp&&'owner'===t.role&&!!t.live&&(t.pairedCount??0)>0}},1474,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useQuestionnaire=P,_e.useProvenance=R,_e.Tick=B,_e.TickLegend=A,_e.useOnboardingDue=O,_e.OnboardingHost=function({go:e}){const{rid:t,role:s}=(0,v.useCtx)(6e4),n=P(t),r=O(t,n);return'owner'===S.APP_VARIANT&&p.CAN.manage(s)&&r&&n?(0,E.jsx)(F,{rid:t,q:n,go:e}):null},_e.SetupChecklist=function({go:e}){const{rid:t}=(0,v.useCtx)(6e4),n=P(t),r=(0,m.useOnboard)(e=>e.setup[t]),a=R(t);if(!n)return null;const o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,l=n.onboardedAt||r?.finished;return(0,E.jsxs)(i.default,{style:{gap:10},testID:"setup-checklist",children:[(0,E.jsxs)(u.Card,{highlight:k.colours.gold,children:[(0,E.jsxs)(u.T,{weight:"semibold",children:[l?'Set up':'Getting set up',n.onboardedAt?` \xb7 since ${(0,f.ukDate)(n.onboardedAt)}`:r?.finished?` \xb7 ${(0,f.ukDate)(r.finished)}`:'']}),(0,E.jsx)(i.default,{style:{height:8,borderRadius:4,backgroundColor:k.colours.surface2,overflow:'hidden'},children:(0,E.jsx)(i.default,{style:{width:100*(l&&!o?1:o/w.STEP_IDS.length)+"%",height:8,backgroundColor:k.colours.ok}})}),(0,E.jsx)(u.Muted,{children:n.onboardedAt&&!o?'This venue was set up before the walkthrough existed. Replay it any time to check everything.':`${o} of ${w.STEP_IDS.length} pages checked on this device.`}),(0,E.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(u.Button,{kind:"success",label:l?'Replay welcome':'Resume setup',testID:"replay-welcome",onPress:()=>m.useOnboard.getState().setReplay(t)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Guided setup (detailed)",onPress:()=>e('more','setup')})]})]}),a.any?(0,E.jsx)(A,{}):null,w.STEP_IDS.map(t=>{const n=r?.steps[t],o=_[t].map(e=>a.mark(...e)),l=o.filter(e=>'q'===e).length,d=o.filter(e=>'edited'===e).length;return(0,E.jsx)(u.Card,{onPress:()=>e('more',M[t].page),children:(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,E.jsx)(s.Icon,{name:q[t],size:20,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:w.STEP_TITLE[t]}),(0,E.jsx)(u.Muted,{size:13,children:M[t].label}),l||d?(0,E.jsxs)(u.Row,{gap:6,style:{marginTop:4},children:[l?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"q"}),(0,E.jsx)(u.Muted,{size:12,children:'team'===t||'suppliers'===t||'accounts'===t||'features'===t?'Pre-filled from your questionnaire':`${l} pre-filled from your questionnaire`})]}):null,d?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsxs)(u.Muted,{size:12,children:[d," changed"]})]}):null]}):null]}),(0,E.jsx)(u.Badge,{kind:'done'===n?'ok':'skipped'===n?'amber':'neutral',label:'done'===n?'Checked':'skipped'===n?'Skipped':'To check'})]})},t)}),(0,E.jsxs)(u.Card,{style:{alignItems:'center',backgroundColor:k.colours.bg},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>e('more','tableplan')}),(0,E.jsx)(C.QuestionnaireAnswers,{rid:t,q:n,onEdit:t=>e('more','cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page)})]}),(0,E.jsxs)(u.Card,{style:{alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z}),(0,E.jsx)(u.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),r=e(_r(_d[3])),a=e(_r(_d[4]));_r(_d[5]);var o=e(_r(_d[6]));_r(_d[7]);var l=e(_r(_d[8])),i=e(_r(_d[9])),d=_r(_d[10]),u=_r(_d[11]),c=_r(_d[12]),h=_r(_d[13]),p=_r(_d[14]),y=_r(_d[15]),m=_r(_d[16]),x=_r(_d[17]),b=_r(_d[18]),j=_r(_d[19]),f=_r(_d[20]),w=_r(_d[21]),k=_r(_d[22]),S=_r(_d[23]),v=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),E=_r(_d[27]);function P(e){const s=(0,h.useRestaurant)(e),r=(0,p.useOwner)(e=>e.staff),a=(0,p.useOwner)(e=>e.suppliers),o=(0,y.usePlan)(e),l=(0,m.useOnboard)(t=>t.answers[e]),i=(0,c.useBrand)(e);return(0,n.useMemo)(()=>{if(!s)return null;const n=e===b.VENUE_RID,d=o.areas?.map(e=>e.name)??[],u=(0,j.planCounts)(o),c=(0,w.questionnaireFromFacts)({id:e,name:s.name,tagline:s.tagline,address:s.address??s.location,phone:s.phone,email:s.contactEmail,website:s.website,hasLogo:!!i.logo,hours:s.kitchenHours,hoursNote:s.hoursNote,tables:u.tables||void 0,covers:u.seats||void 0,areas:d.length?d:void 0,team:n?r.filter(e=>e.active).map(e=>({name:e.name,role:e.role,job:e.job})):[],suppliers:n?a.filter(e=>!e.archived).map(e=>({name:e.name,category:e.category,phone:e.phones[0],email:e.email||void 0})):[],pay:s.settings.pay,orderAtTable:s.settings.orderAtTable,takeaway:!s.settings.takeawayPaused,games:s.settings.games,cashUp:s.settings.cashUpRecord}),h=x.SEEDED_ANSWERS[e],p=h?(0,w.cleanQuestionnaire)({...c,...h,venue:{...c.venue,...h.venue??{}},hours:h.hours??c.hours,tables:{...c.tables,...h.tables??{}},team:h.team??[],suppliers:h.suppliers??[],features:{...c.features,...h.features??{}}},e):null;return(0,t.withVenueQuestionnaireAddress)(e,(0,w.mergeQuestionnaire)((0,w.mergeQuestionnaire)(c,p),l??null))},[s,r,a,o,l,e,i.logo])}const D=(e,t)=>t.reduce((e,t)=>null==e?void 0:e[t],e),I=e=>null!=e&&''!==e&&!(Array.isArray(e)&&!e.length);function R(e){const t=(0,m.useOnboard)(t=>t.answers[e]);return(0,n.useMemo)(()=>{const s='imported'===t?.source,n=s?t:x.SEEDED_ANSWERS[e],r=s||'signup-form'===x.SEEDED_ANSWERS[e]?.source;return{mark:(...e)=>{const a=D(n,e);if(!r&&'pay'!==e[0])return null;if(!I(a))return null;if(!s&&t){const s=D(t,e);if(void 0!==s&&JSON.stringify(s)!==JSON.stringify(a))return'edited'}return'q'},any:r||I(D(n,['pay']))}},[t,e])}const _={venue:[['venue','name'],['venue','tagline'],['venue','address'],['venue','phone'],['venue','email'],['venue','website']],hours:[0,1,2,3,4,5,6].map(e=>['hours','days',e]),tables:[['tables','template'],['tables','tables'],['tables','covers'],['tables','areas']],team:[['team']],suppliers:[['suppliers']],accounts:[['accounts']],pay:[['pay','tipsFrequency'],['pay','tipsAnchorPayday'],['pay','wagePayDay'],['pay','wageCutoffDay']],features:[['features']]};function B({mark:e,testID:t}){return e?'q'===e?(0,E.jsx)(i.default,{testID:t??'q-tick',accessibilityLabel:"From your questionnaire",style:{width:20,height:20,borderRadius:10,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:12,weight:"bold",colour:k.colours.onGold,children:"\u2713"})}):(0,E.jsx)(i.default,{testID:"q-edited",accessibilityLabel:"Edited by you",style:{paddingHorizontal:6,height:20,borderRadius:10,borderWidth:1,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:11,colour:k.colours.gold,children:"\u270e edited"})}):(0,E.jsx)(i.default,{style:{width:20}})}function A({edited:e=!0}){return(0,E.jsxs)(u.Row,{gap:12,wrap:!0,children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"q",testID:"q-legend"}),(0,E.jsx)(u.Muted,{size:12,children:"From your questionnaire"})]}),e?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(B,{mark:"edited"}),(0,E.jsx)(u.Muted,{size:12,children:"Changed by you"})]}):null]})}function O(e,t){const s=(0,m.useOnboard)(t=>t.setup[e]);return(0,m.useOnboard)(e=>e.replay)===e||!(!t||t.onboardedAt)&&(!s?.welcomed&&!s?.finished)}const M={venue:{page:'setup-venue',label:'Edit venue details'},hours:{page:'setup-hours',label:'Edit opening hours'},tables:{page:'tableplan',label:'Open the table plan editor'},team:{page:'staff',label:'Edit staff & roles'},suppliers:{page:'suppliers',label:'Edit suppliers'},accounts:{page:'connections',label:'Open Connected accounts'},pay:{page:'paysettings',label:'Edit pay & tips'},features:{page:'features',label:'See all features'}},q={venue:'home',hours:'clock',tables:'table',team:'user',suppliers:'box',accounts:'swap',pay:'payroll',features:'sparkle'},L={bookings:'Table bookings',takeaway:'Takeaway orders',orderAtTable:'Order at table (QR)',tips:'Tips sharing',rota:'Rota & clocking in',games:'Break room game',specials:'Specials board'},z='Chat with CoverCharge support from Settings. Messages stay on this phone until they are connected. Nobody replies automatically.';function W({at:e}){return(0,E.jsx)(u.Row,{gap:6,style:{justifyContent:'center'},children:w.STEP_IDS.map((t,s)=>(0,E.jsx)(i.default,{style:{width:s===e?22:8,height:8,borderRadius:4,backgroundColor:st.replay===e),b=(0,m.useOnboard)(t=>t.setup[e]),j=w.STEP_IDS.findIndex(e=>!b?.steps[e]),[f,S]=(0,n.useState)(x||!b?.welcomed?-1:j<0?w.STEP_IDS.length:j),P=(0,n.useRef)(new a.default.Value(1)).current,[D,I]=(0,n.useState)(!0);(0,n.useEffect)(()=>{let e=!0;r.default.isReduceMotionEnabled().then(t=>{e&&I(t)});const t=r.default.addEventListener('reduceMotionChanged',I);return()=>{e=!1,t.remove()}},[]),(0,n.useEffect)(()=>{if(D)return void P.setValue(1);P.setValue(0);const e=a.default.timing(P,{toValue:1,duration:300,useNativeDriver:!1});return e.start(),()=>e.stop()},[f,D]);const R=m.useOnboard.getState(),_=()=>{b?.welcomed||R.welcome(e),R.setReplay(null)},B=(s,n)=>{'accounts'===s&&'done'===n&&(0,T.importQuestionnaireAccounts)(e,t,y),R.markStep(e,s,n),S(f+1)},A=t=>{b?.welcomed||R.welcome(e),R.setReplay(null);const s='cashup'===t?'cashup':'menu'===t?'menu':'branding'===t?'branding':M[t].page;h('more',s)};return(0,E.jsx)(o.default,{visible:!0,animationType:D?"none":"fade",onRequestClose:_,children:(0,E.jsx)(d.SafeAreaView,{style:{flex:1,backgroundColor:k.colours.bg},children:-1===f?(0,E.jsx)(l.default,{testID:"onboard-welcome",style:{flex:1},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:24,gap:24},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,width:'100%',maxWidth:560,alignItems:'center',gap:22},children:[(0,E.jsx)(i.default,{style:{width:144,height:144,borderRadius:72,alignItems:'center',justifyContent:'center',shadowColor:k.colours.gold,shadowOpacity:.25,shadowRadius:28,shadowOffset:{width:0,height:0}},children:p.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:144}):(0,E.jsx)(i.default,{style:{width:136,height:136,borderRadius:68,borderWidth:2,borderColor:k.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",colour:k.colours.gold,children:t.venue.name.slice(0,1)})})}),(0,E.jsx)(u.T,{center:!0,size:15,colour:k.colours.gold,weight:"semibold",style:{letterSpacing:3,width:'100%'},children:"WELCOME"}),(0,E.jsxs)(u.T,{center:!0,size:30,weight:"bold",style:{width:'100%',maxWidth:'100%'},children:["Thanks for choosing",'\n',"CoverCharge"]}),(0,E.jsxs)(u.T,{center:!0,size:17,colour:k.colours.muted,style:{lineHeight:26,maxWidth:'32ch',width:'100%'},children:["Let\u2019s get ",t.venue.name," ready. Check your details, opening hours and team, then start your day."]}),(0,E.jsx)(u.Button,{testID:"onboard-get-started",label:"Get started",accessibilityLabel:"Get started with your venue setup",onPress:()=>{R.welcome(e),S(0)},style:{minHeight:56,borderRadius:999,width:'100%',maxWidth:320}}),(0,E.jsx)(u.T,{center:!0,size:13,colour:k.colours.muted,testID:"onboard-ota",style:{width:'100%'},children:"Free over-the-air updates. Over-the-air updates will be available free of charge to the app."}),(0,E.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%',marginTop:6},children:[(0,E.jsx)(c.PoweredBy,{size:12}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Chat with CoverCharge support",accessibilityLabel:"Chat with CoverCharge support",onPress:()=>{b?.welcomed||R.welcome(e),R.setReplay(null),h('more','support')}})]})]})}):f===w.STEP_IDS.length?(0,E.jsxs)(l.default,{testID:"onboard-ready-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.ThingsToHaveReady,{onOpenTablePlan:()=>A('tables')}),(0,E.jsx)(u.Button,{testID:"onboard-ready-next",label:"Continue",accessibilityLabel:"Continue to your questionnaire",onPress:()=>S(w.STEP_IDS.length+1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to the previous step",onPress:()=>S(w.STEP_IDS.length-1)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f===w.STEP_IDS.length+1?(0,E.jsxs)(l.default,{testID:"onboard-questionnaire-slide",style:{flex:1,backgroundColor:k.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',padding:22,paddingBottom:40,gap:16,width:'100%',maxWidth:480,alignSelf:'center'},children:[(0,E.jsx)(C.QuestionnaireAnswers,{rid:e,q:t,onEdit:A}),(0,E.jsx)(u.Button,{testID:"onboard-all-correct",label:"All correct",accessibilityLabel:"All correct. Finish the questionnaire.",onPress:()=>S(w.STEP_IDS.length+2)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Back",accessibilityLabel:"Back to things to have ready",onPress:()=>S(w.STEP_IDS.length)}),(0,E.jsx)(u.Button,{kind:"ghost",label:"Finish later",accessibilityLabel:"Finish later",onPress:_})]}):f>w.STEP_IDS.length+1?(0,E.jsx)(G,{rid:e,q:t,onDone:()=>{R.finish(e)}}):(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(i.default,{style:{padding:14,gap:10,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Back",onPress:()=>S(f-1)}),(0,E.jsxs)(u.T,{size:13,colour:k.colours.muted,children:["Step ",f+1," of ",w.STEP_IDS.length]}),(0,E.jsx)(u.Button,{small:!0,kind:"ghost",label:"Finish later",onPress:_})]}),(0,E.jsx)(W,{at:f})]}),(0,E.jsx)(l.default,{contentContainerStyle:{padding:18,paddingBottom:180,gap:14,maxWidth:640,width:'100%',alignSelf:'center'},children:(0,E.jsxs)(a.default.View,{style:{opacity:P,gap:14},children:[(0,E.jsxs)(u.Row,{gap:10,children:[(0,E.jsx)(s.Icon,{name:q[w.STEP_IDS[f]],size:34,colour:k.colours.gold}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{size:24,weight:"bold",children:w.STEP_TITLE[w.STEP_IDS[f]]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:"gold",label:'signup-form'===t.source?'From your questionnaire':'imported'===t.source?'From your imported answers':'From your current setup'}),b?.steps[w.STEP_IDS[f]]?(0,E.jsx)(u.Badge,{kind:'done'===b.steps[w.STEP_IDS[f]]?'ok':'neutral',label:'done'===b.steps[w.STEP_IDS[f]]?'Checked':'Skipped'}):null]})]})]}),(0,E.jsx)(N,{rid:e,step:w.STEP_IDS[f],q:t})]})}),(0,E.jsxs)(i.default,{testID:"onboard-actions",style:{padding:14,gap:8,borderTopWidth:1,borderColor:k.colours.border,maxWidth:640,width:'100%',alignSelf:'center'},children:[(0,E.jsx)(u.Button,{kind:"success",testID:`looks-right-${w.STEP_IDS[f]}`,label:"Looks right \u2713",onPress:()=>B(w.STEP_IDS[f],'done')}),(0,E.jsxs)(u.Row,{gap:8,children:[(0,E.jsx)(u.Button,{kind:"secondary",label:"Edit",onPress:()=>A(w.STEP_IDS[f]),style:{flex:1}}),(0,E.jsx)(u.Button,{kind:"ghost",label:'suppliers'===w.STEP_IDS[f]||'accounts'===w.STEP_IDS[f]?'Skip (optional)':'Skip for now',onPress:()=>B(w.STEP_IDS[f],'skipped'),style:{flex:1}})]})]})]})})})}function $({k:e,v:t,mark:s}){return(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},gap:10,children:[(0,E.jsx)(u.Muted,{children:e}),(0,E.jsx)(u.T,{weight:"medium",style:{flex:1,textAlign:'right'},children:null==t||''===t?'\u2014':String(t)}),void 0!==s?(0,E.jsx)(B,{mark:s}):null]})}function N({rid:e,step:t,q:s}){const n=(0,c.useBrand)(e),{mark:r}=R(e),a=_[t].some(e=>r(...e))?(0,E.jsx)(A,{edited:_[t].some(e=>'edited'===r(...e))}):null;return(0,E.jsxs)(i.default,{style:{gap:10},children:[a,(0,E.jsx)(V,{rid:e,step:t,q:s,brand:n,mark:r})]})}function V({rid:e,step:t,q:s,brand:r,mark:a}){const o=(0,y.usePlan)(e),l=(0,j.planCounts)(o),[d,h]=(0,n.useState)(s.tables.template),[p,x]=(0,n.useState)(s.features);switch(t){case'venue':return(0,E.jsxs)(u.Card,{children:[(0,E.jsxs)(u.Row,{gap:12,children:[r.logo?(0,E.jsx)(c.RestaurantLogo,{rid:e,size:64}):(0,E.jsx)(i.default,{style:{width:64,height:64,borderRadius:32,borderWidth:1,borderColor:k.colours.border,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.Muted,{children:"No logo"})}),(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.T,{size:20,weight:"bold",children:s.venue.name}),(0,E.jsx)(B,{mark:a('venue','name')})]}),s.venue.tagline?(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Muted,{children:s.venue.tagline}),(0,E.jsx)(B,{mark:a('venue','tagline')})]}):null]})]}),(0,E.jsx)($,{k:"Address",v:s.venue.address,mark:a('venue','address')}),(0,E.jsx)($,{k:"Phone",v:s.venue.phone,mark:a('venue','phone')}),(0,E.jsx)($,{k:"Email",v:s.venue.email,mark:a('venue','email')}),(0,E.jsx)($,{k:"Website",v:s.venue.website,mark:a('venue','website')}),r.logo?null:(0,E.jsx)(u.Muted,{children:"No logo yet. Tap Edit, then Branding, to add one; it shows on your guest pages and staff apps."})]});case'hours':return(0,E.jsxs)(u.Card,{children:[w.WEEK_ORDER.map(e=>(0,E.jsx)($,{k:w.DAY_NAMES[e],v:s.hours.days[e]?`${s.hours.days[e][0]} to ${s.hours.days[e][1]}`:'Closed',mark:a('hours','days',e)},e)),s.hours.note?(0,E.jsx)(u.Muted,{children:s.hours.note}):null,(0,E.jsx)(u.Muted,{children:"Guests see these on your booking and order pages. Bookings outside them are turned away."})]});case'tables':return(0,E.jsxs)(u.Card,{children:[l.tables>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(u.T,{center:!0,weight:"semibold",testID:"onboard-saved-plan",children:["Your table plan: ",l.tables," tables, ",l.seats," Covers"]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your layout is already saved. Use Edit to change it, or Looks right to keep it."})]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",children:"Start from a template or keep your own"}),(0,E.jsx)(u.Muted,{center:!0,children:"Choose a starting layout. You can move every table afterwards."}),(0,E.jsx)(i.default,{style:{gap:8,width:'100%'},children:Object.keys(w.TEMPLATE_LABEL).map(t=>(0,E.jsx)(u.Chip,{label:`${w.TEMPLATE_LABEL[t]}${d===t?' \xb7 Selected':''}`,selected:d===t,onPress:()=>{h(t),m.useOnboard.getState().saveAnswers(e,{...s,tables:{...s.tables,template:t}})}},t))})]}),(0,E.jsx)(u.Muted,{center:!0,children:"Your table plan drives bookings, walk-ins and the floor screen."})]});case'team':{const e=s.team.filter(e=>'owner'!==e.role);return(0,E.jsxs)(u.Card,{children:[s.team.length?s.team.map((e,t)=>(0,E.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:6,borderBottomWidth:1,borderColor:k.colours.border},children:[(0,E.jsxs)(i.default,{style:{flex:1},children:[(0,E.jsx)(u.T,{weight:"medium",children:e.name}),(0,E.jsxs)(u.Muted,{size:13,children:[e.job??'',e.email?` \xb7 ${e.email}`:e.phone?` \xb7 ${e.phone}`:'']})]}),(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(u.Badge,{kind:'staff'===e.role?'neutral':'gold',label:'owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff'}),(0,E.jsx)(B,{mark:a('team',t,'name')})]})]},t)):(0,E.jsx)(u.Muted,{children:"No team listed yet. Add people with Edit."}),(0,E.jsx)(u.Banner,{kind:"info",title:`${e.length} invite link${1===e.length?'':'s'} prepared`,children:(0,E.jsx)(u.Muted,{children:"Each person gets their own sign-in link for the Staff app (managers also get the Managers app). They are ready to share from Staff & roles when you are. Nothing has been sent."})})]})}case'suppliers':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Optional. Suppliers feed your order sheets and the shellfish and stock counts."}),s.suppliers.length?s.suppliers.map((e,t)=>(0,E.jsx)($,{k:e.name,v:[e.category,e.phone??e.email].filter(Boolean).join(' \xb7 '),mark:a('suppliers',t,'name')},t)):null,(0,E.jsx)(u.T,{weight:"bold",style:{marginTop:6},children:"Ordering websites"}),(0,E.jsx)(u.Muted,{size:13,children:"Order from your suppliers? Add supplier links here."}),(0,E.jsx)(T.SupplierPortals,{rid:e,compact:!0})]});case'accounts':return(0,E.jsx)(T.AccountsStep,{q:s,mark:a});case'pay':{const e=s.pay?(0,f.cleanPay)(s.pay):null,t=(0,f.ymdOf)(new Date);if(!e)return(0,E.jsx)(u.Card,{children:(0,E.jsx)(u.Muted,{children:"You didn\u2019t tell us your pay dates. Tap Edit to set when tips and wages are paid; until then Payroll hours uses calendar months."})});const n=(0,f.nextToPay)(e,'tips',t).period,r=(0,f.nextToPay)(e,'wage',t).period;return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)($,{k:"Tips",v:""+('fortnightly'===e.tipsFrequency?'Every two weeks':'weekly'===e.tipsFrequency?'Every week':'Monthly'),mark:a('pay','tipsFrequency')}),(0,E.jsx)($,{k:"Next tips payday",v:n.payday?`${(0,f.ukDate)(n.payday)} (${(0,f.rangeText)(n.start,n.end)})`:'',mark:a('pay','tipsAnchorPayday')}),(0,E.jsx)($,{k:"Wages paid on",v:`the ${e.wagePayDay}${1===e.wagePayDay||21===e.wagePayDay||31===e.wagePayDay?'st':2===e.wagePayDay||22===e.wagePayDay?'nd':3===e.wagePayDay||23===e.wagePayDay?'rd':'th'} of the month`,mark:a('pay','wagePayDay')}),(0,E.jsx)($,{k:"Next payday",v:r.payday?`${(0,f.ukDate)(r.payday)} (${(0,f.rangeText)(r.start,r.end)})`:'',mark:a('pay','wageCutoffDay')}),(0,E.jsx)(u.Muted,{children:"Payroll hours and Tips day use these dates. Only confirmed (signed-off) hours count."})]})}case'features':return(0,E.jsxs)(u.Card,{children:[(0,E.jsx)(u.Muted,{children:"Switch on what you\u2019ll use. You can change these any time in Settings."}),Object.keys(L).map(t=>(0,E.jsxs)(u.Row,{gap:6,children:[(0,E.jsx)(i.default,{style:{flex:1},children:(0,E.jsx)(u.Toggle,{label:L[t],value:p[t],onChange:n=>{return r={...p,[t]:n},x(r),void m.useOnboard.getState().saveAnswers(e,{...s,features:r});var r}})}),(0,E.jsx)(B,{mark:a('features',t)})]},t)),(0,E.jsx)(u.Muted,{size:12,children:"Saved with your answers on this device. Turning on Order at table or the game also needs a manager to switch it on in its own settings page."})]})}}function G({rid:e,q:t,onDone:s}){const r=(0,m.useOnboard)(t=>t.setup[e]),o=w.STEP_IDS.filter(e=>'done'===r?.steps[e]).length,i=w.STEP_IDS.filter(e=>'skipped'===r?.steps[e]),d=(0,n.useRef)(new a.default.Value(0)).current;return(0,n.useEffect)(()=>{a.default.spring(d,{toValue:1,friction:5,useNativeDriver:!1}).start()},[]),(0,E.jsxs)(l.default,{contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:28,gap:16},children:[(0,E.jsx)(a.default.View,{style:{transform:[{scale:d}],width:104,height:104,borderRadius:52,backgroundColor:k.colours.ok,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(u.T,{size:52,weight:"bold",children:"\u2713"})}),(0,E.jsx)(u.T,{size:30,weight:"bold",style:{textAlign:'center'},children:"You\u2019re all set"}),(0,E.jsxs)(u.T,{size:16,colour:k.colours.muted,style:{textAlign:'center',maxWidth:440},children:[t.venue.name," is ready to go. ",o," of ",w.STEP_IDS.length," checked",i.length?`; ${i.map(e=>w.STEP_TITLE[e].toLowerCase()).join(', ')} left for later in Settings \u203a Setup checklist`:'',"."]}),(0,E.jsxs)(u.Card,{style:{maxWidth:440,alignItems:'center'},children:[(0,E.jsx)(u.T,{center:!0,weight:"semibold",colour:k.colours.gold,children:"Chat with CoverCharge support"}),(0,E.jsx)(u.Muted,{center:!0,children:z})]}),(0,E.jsx)(u.Button,{kind:"success",label:"Open my dashboard",onPress:s,testID:"onboard-finish"})]})}},1475,[817,1190,17,264,266,347,378,219,278,85,19,777,857,860,876,998,1036,1037,805,842,1034,1476,804,856,1057,1477,1480,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return l}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},l=u(n.name,80);if(!l)return null;const y={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;y[a]=s&&n?[s,n]:null}const b=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:u(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:u(o.submittedAt,10),onboardedAt:u(o.onboardedAt,10),venue:{name:l,tagline:u(n.tagline,120),address:u(n.address,200),phone:u(n.phone,30),email:u(n.email,120),website:u(n.website,120),hasLogo:!!n.hasLogo},hours:{days:y,note:u(o.hours?.note,300)},tables:{template:b,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>u(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:u(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:u(a?.job,60),email:u(a?.email,120),phone:u(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:u(a?.name,80)??'',category:u(a?.category,40),phone:u(a?.phone,30),email:u(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:u(a?.provider,40)??'',handle:u(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:u(o.notes,1e3),...Array.isArray(o.cashUp)?{cashUp:o.cashUp.map(a=>u(a,40)).filter(a=>!!a).slice(0,12)}:{}}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,email:a.email,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...a.cashUp?.length?{cashUp:a.cashUp.slice(0,12)}:{},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features},cashUp:t.cashUp?.length?t.cashUp:a.cashUp}},e.hoursLines=function(a){return l.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return y}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],l=[1,2,3,4,5,6,0],u=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const y={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},1476,[1034]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ProviderLogo=w,_e.SupplierPortals=C,_e.importQuestionnaireAccounts=B,_e.AccountsStep=function({q:e,mark:n}){const t=e.accounts??[];return(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.Muted,{children:"The services your venue already uses. Nothing signs in during setup."}),t.length?t.map((e,t)=>{const s=(0,c.providerById)(e.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6,borderBottomWidth:1,borderColor:h.colours.border},children:[s?(0,y.jsx)(w,{p:s,size:32}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??e.provider}),e.handle?(0,y.jsx)(a.Muted,{size:13,children:e.handle}):null]}),(0,y.jsx)(p.Tick,{mark:n('accounts',t,'provider')})]},t)}):(0,y.jsx)(a.Muted,{children:"None listed. Skip, and add them any time in Settings \u203a Connected accounts."}),(0,y.jsx)(a.Muted,{size:13,children:"Looks right adds these to Settings \u203a Connected accounts. Connecting (signing in) happens there, when you\u2019re ready."})]})},_e.ConnectionsPage=function(){const{rid:e,role:n,me:l}=(0,x.useCtx)(6e4),j='owner'===n,I=(0,u.useAccounts)(n=>n.byVenue[e])??b,S=(0,u.useAccounts)(n=>n.log[e])??[],M=(0,p.useQuestionnaire)(e),{mark:P}=(0,p.useProvenance)(e),[A,z]=(0,t.useState)(null),[$,D]=(0,t.useState)(null),[L,N]=(0,t.useState)(!1),O=(0,t.useMemo)(()=>(M?.accounts??[]).map((e,n)=>({a:e,i:n})).filter(({a:e})=>!I.some(n=>n.provider===e.provider)),[M,I]),W=(M?.accounts??[]).some((e,n)=>P('accounts',n,'provider'));return(0,y.jsxs)(i.default,{testID:"connections-page",style:{gap:14},children:[(0,y.jsx)(a.Muted,{children:"The outside services your venue uses: email, website, socials, bookings, payments, accounting and suppliers. Add, re-connect or remove them any time."}),(0,y.jsx)(a.Banner,{kind:"success",title:"Your sign-ins stay safe",children:(0,y.jsx)(a.Muted,{children:"Connecting happens on each service\u2019s own sign-in page. CoverCharge never keeps passwords on this device, and manual sign-in details will only be stored encrypted on our servers, owner-only."})}),W?(0,y.jsx)(p.TickLegend,{edited:!1}):null,O.length?(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:"From your questionnaire"}),O.map(({a:n,i:t})=>{const s=(0,c.providerById)(n.provider);return(0,y.jsxs)(a.Row,{gap:10,style:{paddingVertical:6},children:[s?(0,y.jsx)(w,{p:s,size:34}):null,(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:s?.name??n.provider}),n.handle?(0,y.jsx)(a.Muted,{size:13,children:n.handle}):null]}),(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}),j?(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Add",onPress:()=>u.useAccounts.getState().add(e,{provider:n.provider,handle:n.handle,status:'listed',from:'questionnaire',addedBy:l})}):null]},n.provider)}),j&&O.length>1?(0,y.jsx)(a.Button,{kind:"success",label:`Add all ${O.length}`,onPress:()=>M&&B(e,M,l)}):null]}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Your accounts"}),(0,y.jsx)(a.Badge,{kind:"gold",label:`${I.length}`})]}),I.length?I.map(e=>{const n=(0,c.providerById)(e.provider)??v('suppliers'),t=(M?.accounts??[]).findIndex(n=>n.provider===e.provider);return(0,y.jsxs)(i.default,{testID:`conn-row-${e.provider}`,style:{paddingVertical:8,borderBottomWidth:1,borderColor:h.colours.border,gap:6},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:n,size:36}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"medium",children:f(e)}),(0,y.jsx)(a.Muted,{size:13,children:[c.CATEGORY_TITLE[n.category],e.handle,e.accountNo?`Account ${e.accountNo}`:''].filter(Boolean).join(' \xb7 ')})]}),'questionnaire'===e.from&&t>=0?(0,y.jsx)(p.Tick,{mark:P('accounts',t,'provider')}):null,(0,y.jsx)(a.Badge,{kind:T[e.status].kind,label:T[e.status].label})]}),j?(0,y.jsxs)(a.Row,{gap:8,children:[n.links?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",label:"Open ordering",onPress:()=>{s.default.openURL(n.links.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Log in",onPress:()=>{s.default.openURL(n.links.login)}})]}):(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:'connected'===e.status?'Re-connect':'Connect',onPress:()=>z({p:n,existing:e})}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`conn-remove-${e.provider}`,label:"Remove",onPress:()=>D(e)})]}):null]},e.id)}):(0,y.jsx)(a.Muted,{children:"Nothing added yet. Pick a service below."}),j?null:(0,y.jsx)(a.Muted,{size:13,children:"Only the owner can add or remove the venue\u2019s accounts."})]}),j?c.CATEGORY_ORDER.map(n=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"bold",children:c.CATEGORY_TITLE[n]}),'suppliers'===n?(0,y.jsx)(C,{rid:e}):null,(0,y.jsx)(a.Row,{gap:10,wrap:!0,children:[...c.PROVIDERS.filter(e=>e.category===n&&!e.links),v(n)].map(e=>{const n=I.some(n=>n.provider===e.id);return(0,y.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Connect ${e.name}`,testID:`conn-tile-${e.id}`,onPress:()=>z({p:e}),style:{width:104,padding:10,borderRadius:12,borderWidth:1,borderColor:n?h.colours.ok:h.colours.border,alignItems:'center',justifyContent:'center',gap:6,backgroundColor:h.colours.surface2},children:[(0,y.jsx)(w,{p:e,size:40}),(0,y.jsx)(a.T,{size:12,style:{textAlign:'center'},children:e.id.startsWith('other-')?'Other / enter manually':e.name}),n?(0,y.jsx)(a.Badge,{kind:"ok",label:"Added"}):null]},e.id)})})]},n)):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(o.default,{accessibilityRole:"button",onPress:()=>N(!L),children:(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{weight:"bold",children:"Activity"}),(0,y.jsx)(a.Muted,{children:L?'Hide':`Show (${S.length})`})]})}),L?S.length?S.slice(0,30).map((e,n)=>(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(a.Muted,{size:13,children:[e.what," \xb7 ",e.by]}),(0,y.jsx)(a.Muted,{size:12,children:new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})})]},n)):(0,y.jsx)(a.Muted,{children:"No changes yet."}):null]}),(0,y.jsx)(R,{rid:e,sheet:A,owner:j,by:l,onClose:()=>z(null)}),$?(0,y.jsx)(k,{rid:e,c:$,by:l,onClose:()=>D(null)}):null]})};var n=r(d[0]),t=r(d[1]),s=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),i=e(r(d[5])),a=r(d[6]),c=r(d[7]),u=r(d[8]),h=r(d[9]),p=r(d[10]),x=r(d[11]),j=r(d[12]),y=r(d[13]);const b=[],v=e=>({id:`other-${e}`,name:'Other',category:e,colour:'#2A2722',mark:'+',handleLabel:'Name of the service',oauth:'soon'}),f=e=>e.customName??(0,c.providerById)(e.provider)?.name??e.provider;function w({p:e,size:n=40}){return(0,y.jsx)(i.default,{accessibilityLabel:`${e.name} logo`,style:{width:n,height:n,borderRadius:.24*n,backgroundColor:e.colour,borderWidth:1,borderColor:h.colours.border,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(a.T,{size:Math.round(n*(e.mark.length>2?.3:.42)),weight:"bold",colour:e.fg??'#fff',children:e.mark})})}function C({rid:e,compact:n}){const{role:o,me:l}=(0,x.useCtx)(6e4),p=j.CAN.manage(o),v=(0,u.useAccounts)(n=>n.byVenue[e])??b,[f,C]=(0,t.useState)({}),[B,I]=(0,t.useState)(null),T=u.useAccounts.getState();return(0,y.jsxs)(i.default,{style:{gap:10,width:'100%',maxWidth:'100%',minWidth:0},testID:"supplier-portals",children:[c.SUPPLIER_PORTALS.map(t=>{const o=v.find(e=>e.provider===t.id),c=t.links,u=f[t.id]??o?.accountNo??'';return(0,y.jsxs)(i.default,{testID:`portal-${t.id}`,style:{width:'100%',maxWidth:'100%',minWidth:0,alignSelf:'stretch',gap:10,padding:10,borderRadius:12,borderWidth:1,borderColor:o?h.colours.ok:h.colours.border,backgroundColor:h.colours.surface2},children:[(0,y.jsxs)(i.default,{style:{alignItems:'center',gap:8,width:'100%'},children:[(0,y.jsx)(w,{p:t,size:n?34:40}),(0,y.jsx)(a.T,{center:!0,weight:"bold",children:t.name}),t.note?(0,y.jsx)(a.Muted,{center:!0,size:13,children:t.note}):null,o?(0,y.jsx)(a.Badge,{kind:"gold",label:"Added"}):null]}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Button,{small:!0,kind:"success",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-order-${t.id}`,label:"Open ordering",onPress:()=>{s.default.openURL(c.order)}}),(0,y.jsx)(a.Button,{small:!0,kind:"secondary",style:{flex:1,minWidth:0,paddingHorizontal:6},testID:`portal-login-${t.id}`,label:"Log in",onPress:()=>{s.default.openURL(c.login)}})]}),p?(0,y.jsxs)(i.default,{style:{gap:8,width:'100%',alignItems:'stretch'},children:[(0,y.jsx)(a.Field,{label:`${c.accountLabel} (optional)`,value:u,onChangeText:e=>C({...f,[t.id]:e}),placeholder:"e.g. 123456789",autoCapitalize:"characters",testID:`portal-acct-${t.id}`}),(0,y.jsx)(i.default,{style:{gap:8,width:'100%'},children:o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Save number",disabled:u===(o.accountNo??''),onPress:()=>T.update(e,o.id,{accountNo:u},l,`Updated ${t.name} account number`)}),(0,y.jsx)(a.Button,{small:!0,kind:"ghost",testID:`portal-remove-${t.id}`,label:"Remove",onPress:()=>I(o)})]}):(0,y.jsx)(a.Button,{small:!0,kind:"success",testID:`portal-add-${t.id}`,label:`Add ${t.name}`,onPress:()=>T.add(e,{provider:t.id,accountNo:u||void 0,status:'listed',from:'added',addedBy:l})})}),(0,y.jsxs)(a.Muted,{center:!0,size:12,children:["Sign in on ",t.name,"\u2019s website. Your password is not stored here."]})]}):o?.accountNo?(0,y.jsxs)(a.Muted,{size:13,children:["Account ",o.accountNo]}):null]},t.id)}),B?(0,y.jsx)(k,{rid:e,c:B,by:l,onClose:()=>I(null)}):null]})}function k({rid:e,c:n,by:t,onClose:s}){return(0,y.jsx)(a.Sheet,{visible:!0,onClose:s,title:`Remove ${f(n)}?`,testID:"conn-remove-sheet",children:(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(a.Banner,{kind:"danger",title:"This removes it from CoverCharge for this venue",children:(0,y.jsxs)(a.Muted,{children:["CoverCharge will stop listing ",f(n),". Nothing is deleted in your ",f(n)," account itself, and you can add it again later."]})}),(0,y.jsx)(a.Button,{kind:"danger",testID:"conn-remove-confirm",label:`Yes, remove ${f(n)}`,onPress:()=>{u.useAccounts.getState().remove(e,n.id,t),s()}}),(0,y.jsx)(a.Button,{kind:"ghost",label:"Keep it",onPress:s})]})})}function B(e,n,t){const s=u.useAccounts.getState(),o=s.byVenue[e]??[];for(const l of n.accounts??[])o.some(e=>e.provider===l.provider)||s.add(e,{provider:l.provider,handle:l.handle,status:'listed',from:'questionnaire',addedBy:t})}function I({rid:e,p:s,existing:p,owner:x,by:j,onClose:b}){const[v,C]=(0,t.useState)(p?.handle??''),[k,B]=(0,t.useState)(p?.customName??''),[I,T]=(0,t.useState)(!1),[R,S]=(0,t.useState)(!1);if(!s)return null;const M=s.id.startsWith('other-');return(0,y.jsx)(a.Sheet,{visible:!0,onClose:b,title:p?`Re-connect ${f(p)}`:`Connect ${M?'another service':s.name}`,testID:"connect-sheet",children:(0,y.jsxs)(l.default,{contentContainerStyle:{gap:12},children:[(0,y.jsxs)(a.Row,{gap:10,children:[(0,y.jsx)(w,{p:s,size:44}),(0,y.jsxs)(i.default,{style:{flex:1},children:[(0,y.jsx)(a.T,{weight:"bold",children:M?c.CATEGORY_TITLE[s.category]:s.name}),s.note?(0,y.jsx)(a.Muted,{size:13,children:s.note}):null]})]}),M?(0,y.jsx)(a.Field,{label:"Service name",value:k,onChangeText:B,placeholder:"e.g. our local fish supplier\u2019s portal",testID:"conn-custom-name"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a.Button,{kind:"success",testID:"connect-oauth",label:`Connect with ${s.name}`,onPress:()=>T(!0)}),(0,y.jsxs)(a.Row,{gap:6,children:[(0,y.jsx)(a.Badge,{kind:"amber",label:"Coming soon"}),(0,y.jsxs)(a.Muted,{size:13,style:{flex:1},children:["You\u2019ll sign in on ",s.name,"\u2019s own page; CoverCharge never sees your password."]})]}),I?(0,y.jsx)(a.Banner,{kind:"info",title:`Connect with ${s.name} is coming soon`,children:(0,y.jsx)(a.Muted,{children:"It isn\u2019t switched on yet. For now, save it to your list below, and we\u2019ll tell you when it\u2019s ready."})}):null]}),(0,y.jsx)(a.Field,{label:`${s.handleLabel} (public name only, optional)`,value:v,onChangeText:C,placeholder:s.handleLabel,autoCapitalize:"none",testID:"conn-handle"}),(0,y.jsx)(a.Button,{kind:M?'success':'secondary',testID:"conn-save-list",label:p?'Save changes':'Save to my list',onPress:()=>{const n=u.useAccounts.getState();p?n.update(e,p.id,{handle:v.trim()||void 0,customName:M&&k.trim()||void 0},j,`Updated ${f(p)}`):n.add(e,{provider:s.id,customName:M?k.trim()||'Other':void 0,handle:v.trim()||void 0,status:'listed',from:'added',addedBy:j}),b()},disabled:M&&!k.trim()}),(0,y.jsx)(o.default,{accessibilityRole:"button",testID:"conn-manual-toggle",onPress:()=>S(!R),children:(0,y.jsxs)(a.T,{colour:h.colours.goldLight,children:[R?'\u25be':'\u25b8'," Other / enter sign-in details manually"]})}),R?x?(0,y.jsxs)(i.default,{style:{gap:8},testID:"conn-manual",children:[(0,y.jsx)(a.Banner,{kind:"warn",title:"Secure storage coming next",children:(0,y.jsx)(a.Muted,{children:"Manual sign-in details will only ever be saved encrypted on our servers: visible to the owner only, shown masked (like \u2022\u2022\u2022\u2022\u2022\u202242), and every view is logged. That storage isn\u2019t switched on yet, so nothing can be entered here today. Nothing is ever saved on this device."})}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Username or email"}),(0,y.jsx)(n.TextInput,{editable:!1,style:a.styles.input,placeholder:"Available when secure storage is ready",placeholderTextColor:h.colours.muted})]}),(0,y.jsxs)(i.default,{style:{gap:4,opacity:.5},children:[(0,y.jsx)(a.Muted,{size:13,children:"Password"}),(0,y.jsx)(n.TextInput,{editable:!1,secureTextEntry:!0,style:a.styles.input,placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",placeholderTextColor:h.colours.muted})]}),(0,y.jsx)(a.Button,{kind:"success",testID:"manual-save",label:"Secure storage coming next",disabled:!0})]}):(0,y.jsx)(a.Banner,{kind:"info",title:"Owner only",children:(0,y.jsx)(a.Muted,{children:"Only the owner can add sign-in details for the venue\u2019s accounts."})}):null,(0,y.jsx)(a.Button,{kind:"ghost",label:"Close",onPress:b})]})})}const T={connected:{kind:'ok',label:'Connected'},listed:{kind:'neutral',label:'Listed \xb7 not signed in'},'needs-reconnect':{kind:'amber',label:'Needs re-connecting'}};function R({rid:e,sheet:n,owner:t,by:s,onClose:o}){return n?(0,y.jsx)(I,{rid:e,p:n.p,existing:n.existing,owner:t,by:s,onClose:o},n.existing?.id??n.p.id):null}},1477,[812,17,362,385,278,85,777,1478,1479,804,1475,1057,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CATEGORY_TITLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CATEGORY_ORDER",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PROVIDERS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"providerById",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"SUPPLIER_PORTALS",{enumerable:!0,get:function(){return c}});const o={email:'Email',website:'Website',social:'Work social media',bookings:'Bookings & reviews',payments:'Payments & till',accounting:'Accounting',suppliers:'Suppliers'},s=['email','website','social','bookings','payments','accounting','suppliers'],n=(o,s,n,t,l,c,u,b)=>({id:o,name:s,category:n,colour:t,mark:l,handleLabel:c,oauth:'soon',fg:u,note:b}),t=[n('gmail','Gmail','email','#EA4335','G','Email address'),n('outlook','Outlook','email','#2A2722','O','Email address'),n('icloud','iCloud Mail','email','#2A2722','\u2601','Email address'),n('yahoo','Yahoo Mail','email','#2A2722','Y!','Email address'),n('wix','Website bookings','website','#FFFFFF','WB','Website address','#000000'),n('shopify','Shopify','website','#B08D57','S','Shop address'),n('squarespace','Squarespace','website','#111111','\u25a3','Website address'),n('wordpress','WordPress','website','#2A2722','W','Website address'),n('godaddy','GoDaddy','website','#E2C489','GD','Website address','#1F1A12'),n('facebook','Facebook Page','social','#2A2722','f','Page name',void 0,'Your venue\u2019s Page, not a personal profile.'),n('instagram','Instagram (business)','social','#C13584','IG','@handle',void 0,'A business or creator account.'),n('tiktok','TikTok','social','#000000','\u266a','@handle'),n('google-business','Google Business Profile','social','#2A2722','G','Business name'),n('wix-tables','Website bookings table reservations','bookings','#FFFFFF','WT','Site','#000000'),n('tripadvisor','Tripadvisor','bookings','#E2C489','TA','Listing','#000000'),n('sumup','SumUp','payments','#1A1A1A','SU','Merchant'),n('stripe','Stripe','payments','#2A2722','S','Account'),n('zettle','Zettle by PayPal','payments','#2A2722','Z','Account'),n('quickbooks','QuickBooks','accounting','#8A6A3B','qb','Company'),n('xero','Xero','accounting','#2A2722','x','Organisation'),n('cc-books','CoverCharge Books','accounting','#CFA45F','CC','Books','#1A1408','Our own simple bookkeeping (coming soon).'),{...n('bidfood','Bidfood','suppliers','#E30613','BF','Account name'),note:'Wholesale food, drink and catering supplies.',links:{order:'https://www.bidfood.co.uk/login/',login:'https://www.bidfood.co.uk/login/',accountLabel:'Bidfood account number'}},{...n('booker','Booker','suppliers','#0055A5','B','Account name'),note:'Wholesale and cash & carry.',links:{order:'https://www.booker.co.uk',login:'https://www.booker.co.uk',accountLabel:'Booker customer number'}},n('coldweb','Coldweb','suppliers','#2A2722','CW','Customer account'),n('supplier-custom','Other supplier portal','suppliers','#2A2722','+','Supplier and account')],l=o=>t.find(s=>s.id===o),c=t.filter(o=>o.links)},1478,[]); +__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)}))},1479,[824,831,834]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ThingsToHaveReady=function({onOpenTablePlan:e}){return(0,h.jsxs)(s.default,{testID:"onboard-ready",style:{width:'100%',alignItems:'center',gap:14},children:[b('Things to have ready'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Gather these before you check the questionnaire. Nothing here is sent."}),d.READY_ITEMS.map((t,a)=>(0,h.jsxs)(s.default,{testID:`ready-item-${a+1}`,accessible:!0,accessibilityLabel:t,style:{width:'100%',alignItems:'center',gap:6,minHeight:48},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:"\u2713"}),(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:t}),0===a&&e?(0,h.jsx)(n.Button,{kind:"ghost",label:"Open the table plan",accessibilityLabel:"Open the table plan to add a drawing or picture",onPress:e}):null]},t))]})},_e.QuestionnaireAnswers=function({q:e,rid:t,onEdit:y}){const E=(0,i.usePlan)(t),j=(0,a.useMenu)(t),f=(0,l.useAccounts)(e=>e.byVenue[t])??p,x=(E.areas??[]).map(e=>{const t=(0,o.planCounts)(E,e.id);return t.tables?`${e.name}: ${t.tables} ${1===t.tables?'table':'tables'}, ${t.seats} Covers`:e.name}),$=x.length?x:(e.tables.areas??[]).map(e=>e);(e.tables.tables||e.tables.covers)&&$.unshift([e.tables.tables?`${e.tables.tables} tables`:'',e.tables.covers?`${e.tables.covers} Covers`:''].filter(Boolean).join(', '));const w=c.WEEK_ORDER.map(t=>`${c.DAY_NAMES[t]}: ${e.hours.days[t]?`${e.hours.days[t][0]} to ${e.hours.days[t][1]}`:'Closed'}`),D=e.team.map(e=>{const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Staff',s=e.job&&e.job.trim().toLowerCase()!==t.toLowerCase()?e.job.trim():'';return[e.name,s,t].filter(Boolean).join(', ')}),v=e.suppliers.map(e=>[e.name,e.category,e.phone,e.email].filter(Boolean).join(', ')),I=f.filter(e=>e.accountNo).map(e=>`${e.customName||e.provider}: ${e.accountNo}`),L=e.pay?["Tips "+('fortnightly'===e.pay.tipsFrequency?'every two weeks':'weekly'===e.pay.tipsFrequency?'every week':'monthly'),e.pay.tipsAnchorPayday?`Next tips payday anchor ${e.pay.tipsAnchorPayday}`:'',e.pay.wagePayDay?`Wages on day ${e.pay.wagePayDay}`:''].filter(Boolean):[],T=j.filter(e=>Object.keys(e.allergens??{}).length).length,q=j.length?[`${j.length} ${1===j.length?'dish':'dishes'} on the menu`]:[],N=j.length?[T?`Recorded on ${T} ${1===T?'dish':'dishes'}`:d.NOT_ANSWERED]:[],_=[e.venue.name,e.venue.tagline,e.venue.address,e.venue.phone,e.venue.email,e.venue.website].filter(e=>!!e&&''!==e.trim());return(0,h.jsxs)(s.default,{testID:"onboard-questionnaire",style:{width:'100%',alignItems:'center',gap:4},children:[b('Your questionnaire'),(0,h.jsx)(n.T,{center:!0,colour:u.colours.muted,children:"Tap a section to edit it. Blank answers stay blank."}),(0,h.jsx)(m,{testID:"q-venue",title:"Venue",lines:_,onEdit:()=>y('venue'),editLabel:"Edit venue"}),(0,h.jsx)(m,{testID:"q-hours",title:"Opening hours",lines:w,onEdit:()=>y('hours'),editLabel:"Edit opening hours"}),(0,h.jsx)(m,{testID:"q-tables",title:"Table plan",lines:$,onEdit:()=>y('tables'),editLabel:"Edit table plan"}),(0,h.jsx)(m,{testID:"q-team",title:"Staff and roles",lines:D,onEdit:()=>y('team'),editLabel:"Edit staff and roles"}),(0,h.jsx)(m,{testID:"q-pay",title:"Pay and tips dates",lines:L,onEdit:()=>y('pay'),editLabel:"Edit pay and tips"}),(0,h.jsx)(m,{testID:"q-suppliers",title:"Suppliers",lines:v,onEdit:()=>y('suppliers'),editLabel:"Edit suppliers"}),(0,h.jsx)(m,{testID:"q-accounts",title:"Supplier account numbers",lines:I,onEdit:()=>y('accounts'),editLabel:"Edit account numbers"}),(0,h.jsx)(m,{testID:"q-logo",title:"Logo",lines:e.venue.hasLogo?['Logo added']:[],onEdit:()=>y('branding'),editLabel:"Edit logo"}),(0,h.jsx)(m,{testID:"q-menu",title:"Menu",lines:q,onEdit:()=>y('menu'),editLabel:"Edit menu"}),(0,h.jsx)(m,{testID:"q-allergens",title:"Allergens",lines:N,onEdit:()=>y('menu'),editLabel:"Edit allergens"}),(0,h.jsx)(m,{testID:"q-cashup",title:"What to record at nightly cash up",lines:e.cashUp??[],onEdit:()=>y('cashup'),editLabel:"Edit cash up"})]})},r(_d[0]);var t=e(r(_d[1])),s=e(r(_d[2])),n=r(_d[3]),a=r(_d[4]),l=r(_d[5]),i=r(_d[6]),o=r(_d[7]),d=r(_d[8]),c=r(_d[9]),u=r(_d[10]),h=r(_d[11]);const p=[],b=e=>(0,h.jsx)(n.T,{accessibilityRole:"header",center:!0,size:22,weight:"bold",colour:u.colours.gold,style:{width:'100%'},children:e});const y=e=>e.replace(/([@.])/g,'$1\u200b');function m({testID:e,title:s,lines:a,onEdit:l,editLabel:i}){const o=a.length?a.join('. '):d.NOT_ANSWERED;return(0,h.jsxs)(t.default,{testID:e,accessibilityRole:"button",accessibilityLabel:`${s}. ${o}. ${i}.`,onPress:l,style:{width:'100%',minHeight:48,alignItems:'center',gap:4,paddingVertical:10,paddingHorizontal:8,borderTopWidth:1,borderColor:u.colours.border},children:[(0,h.jsx)(n.T,{center:!0,weight:"bold",colour:u.colours.gold,children:s}),(a.length?a:[d.NOT_ANSWERED]).map((e,t)=>(0,h.jsx)(n.T,{center:!0,style:{width:'100%'},children:y(e)},`${s}-${t}`)),(0,h.jsx)(n.T,{center:!0,size:14,colour:u.colours.gold,children:i})]})}},1480,[17,385,85,777,860,1479,998,842,1481,1476,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"READY_ITEMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOT_ANSWERED",{enumerable:!0,get:function(){return t}});const n=['A drawing or other picture of the table plan with area names labelled and how many people each seats','Opening hours','Staff and roles','Pay and tips dates','Supplier account numbers','Logo','Menu','Allergens'],t='Not answered yet'},1481,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},1482,[813,17,266,347,219,385,85,831,777,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1483,[1185,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1182,1446,1162,860,1186,853,1184,884,1361,998,843,1115,1199,1206,1071,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Forecasts=function({go:e}){const{rid:v,r:$,now:S,today:T}=(0,x.useCtx)(3e4),{width:B}=(0,a.default)(),C=(0,r.useBookings)(v),D=(0,r.useOrders)(v),M=(0,r.useEvents)(v),[P,A]=(0,s.useState)(7),F=(0,k.useRealHistory)(v,S),E=(0,s.useMemo)(()=>(0,l.forecastToday)($,C,D,M,S,F??void 0),[$,C,D,M,F,S.getTime()/6e4|0]),I=(0,s.useMemo)(()=>Array.from({length:P},(e,s)=>{const t=(0,c.addMins)((0,c.parseYmd)(T),1440*s);return{d:t,f:(0,l.forecastToday)($,C,D,M,t,F??void 0)}}),[$,C,D,M,T,P,F]),R=E.hours.reduce((e,s)=>e+s.booked,0),H=(0,i.showTakeaway)($),[L,N]=(0,s.useState)(H),O=M.filter(e=>e.date>=T).sort((e,s)=>e.date.localeCompare(s.date)).slice(0,14),_=Math.min(B,900)-60,Y=e=>I.map(s=>{const t='booked'===e?s.f.hours.reduce((e,s)=>e+s.booked,0):s.f.restOfDay.covers;return{key:(0,c.ymd)(s.d),label:(0,c.dayShort)(s.d),spoken:(0,c.dayLong)(s.d),value:s.f.open?t:0,open:!!s.f.open}}),G=(0,j.jsx)(d.Row,{gap:4,style:{justifyContent:'center'},children:[7,14].map(e=>(0,j.jsx)(d.Chip,{label:`${e}d`,accessibilityLabel:`Next ${e} days`,selected:P===e,onPress:()=>A(e),testID:`forecast-range-${e}`},e))});return E.enough?(0,j.jsxs)(o.default,{style:{gap:12},children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(o.default,{testID:"forecast-week",style:{flexDirection:'row',justifyContent:'center',alignItems:'center',gap:8,flexWrap:'wrap'},children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:[7===P?'This week':`Next ${P} days`," \xb7 forecast covers"]}),E.example?(0,j.jsx)(k.ExampleBadge,{}):(0,j.jsx)(d.Badge,{kind:"amber",label:"ESTIMATE"})]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('forecast'),titleSpoken:`Forecast covers for the next ${P} days`}),I.filter(e=>e.f.flags.length).map(e=>(0,j.jsxs)(d.Muted,{center:!0,children:[(0,c.niceDate)(e.d),": ",e.f.flags.join(', ')," (\xd7",e.f.multiplier.toFixed(2),")"]},(0,c.ymd)(e.d)))]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",colour:u.colours.gold,children:"Suggested actions"}),E.suggestions.map((e,s)=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},s)),(0,j.jsx)(d.Muted,{children:E.example?`${n.EXAMPLE_ACCURACY}. Example figures: confirmed bookings + example weekday/hour averages + expected walk-ins, adjusted for calendar events.`:'Baseline: confirmed bookings + your own weekday/hour averages from past bookings, walk-ins and takeaway, adjusted for calendar events. An estimate, never a promise.'})]}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:H?u.colours.gold:u.colours.muted,children:"Takeaway"}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:L?'Hide':'Show',testID:"forecast-takeaway-toggle",onPress:()=>N(!L)})]}),L?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d.Muted,{children:"Takeaway orders by hour (forecast vs placed)"}),(0,j.jsx)(f.LineChart,{width:_,series:[E.hours.map(e=>e.takeaway),E.hours.map(e=>e.takeawayPlaced)],labels:E.hours.map(e=>String(e.hour))}),(0,j.jsxs)(d.Row,{gap:12,children:[(0,j.jsx)(d.Muted,{children:"Gold: forecast"}),(0,j.jsx)(d.Muted,{children:"Blue: placed so far"})]})]}):null]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.map(s=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(s.title)}),(0,j.jsx)(d.Badge,{kind:w[s.kind][1],label:w[s.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(s.date))," ",s.date.slice(0,4),s.description?` \xb7 ${s.description}`:'']}),'regular'===s.source?(0,j.jsx)(d.Muted,{children:[s.time?`From ${(0,i.fmt12)(s.time)}`:'',s.lastFood?`last food orders ${(0,i.fmt12)(s.lastFood)}`:'',s.busier?'expect busier':''].filter(Boolean).join(' \xb7 ')}):null,'regular'===s.source?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",testID:`promote-${s.id}`,label:`Promote: ${s.title} ${p(s.date,T)}`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:`${s.title} ${p(s.date,T)}`,body:`${s.title} at ${$.name} ${p(s.date,T)}${s.time?` from ${(0,i.fmt12)(s.time)}`:''}.${s.lastFood?` Food until ${(0,i.fmt12)(s.lastFood)}.`:''} Book a table in the app.`}}),e('more','marketing')}}):'school-holiday'!==s.kind?(0,j.jsx)(d.Button,{small:!0,kind:"secondary",label:`Promote: "${b(s.title)}"`,onPress:()=>{h.useOwner.getState().setOwner({marketingDraft:{title:b(s.title),body:`${b(s.title)} at ${$.name}. Book in the app.`}}),e('more','marketing')}}):null]},s.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]}):(0,j.jsxs)(o.default,{style:{gap:12},testID:"forecast-not-enough",children:[(0,j.jsx)(d.T,{center:!0,size:18,testID:"forecast-busy-level",children:E.busy.words}),(0,j.jsx)(k.NotEnoughHistory,{weeks:E.minWeeks,booked:R}),(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{center:!0,weight:"semibold",colour:u.colours.gold,children:["Booked, next ",P," days"]}),G,(0,j.jsx)(f.DaysLineGraph,{days:Y('booked'),titleSpoken:`Booked covers for the next ${P} days`}),(0,j.jsx)(d.Muted,{children:"Confirmed bookings only. No estimate is added until there is enough history."})]}),(0,j.jsx)(y.SectionHead,{title:"Holidays & local events",sub:"Scottish bank holidays (gov.uk), South Ayrshire school holidays, key dining dates and your events"}),O.slice(0,6).map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",style:{flex:1},children:(0,t.holidayName)(e.title)}),(0,j.jsx)(d.Badge,{kind:w[e.kind][1],label:w[e.kind][0]})]}),(0,j.jsxs)(d.Muted,{children:[(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.date.slice(0,4)]})]},e.id)),(0,j.jsx)(d.Button,{kind:"secondary",label:"Add an event",onPress:()=>e('more','events')})]})};var s=_r(_d[0]),t=_r(_d[1]),o=e(_r(_d[2])),a=e(_r(_d[3])),d=_r(_d[4]),r=_r(_d[5]),n=_r(_d[6]),l=_r(_d[7]),i=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),y=_r(_d[12]),x=_r(_d[13]),f=_r(_d[14]),k=_r(_d[15]),j=_r(_d[16]);const p=(e,s)=>{const t=(0,c.parseYmd)(e),o=Math.round((t.getTime()-(0,c.parseYmd)(s).getTime())/864e5),a=t.toLocaleDateString('en-GB',{weekday:'long'});return o<=0?'tonight':1===o?'tomorrow':o<=6?`this ${a}`:`on ${(0,c.niceDate)(t)}`},b=e=>`${(0,t.holidayName)(e).replace(/ \(example\)| Supper/g,'')} booking now open`,w={'bank-holiday':['Bank holiday','red'],'school-holiday':['School holiday','blue'],occasion:['Key date','gold'],event:['Event','amber']}},1484,[17,1055,85,409,777,858,1141,1140,861,863,804,876,1184,1057,1149,1145,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useShellBadges",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({notifCount:0}))},1485,[831]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderCard=M,_e.Orders=function(){const{rid:e,r:t,now:l,me:s}=(0,w.useCtx)(5e3),n=(0,u.useOrders)(e),[c,h]=(0,r.useState)(!1),[b,y]=(0,r.useState)(null),[f,T]=(0,r.useState)('all'),C=n.filter(k.LIVE).filter(e=>'all'===f||e.type===f).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),v=n.filter(e=>!(0,k.LIVE)(e)&&'awaiting_payment'!==e.status).slice(0,8),B=n.filter(k.LIVE).flatMap(e=>(0,m.readinessFor)(e,t,l).map(t=>({...t,order:e}))),P=B.filter(e=>'due'===e.state||'overdue'===e.state),$=B.filter(e=>'upcoming'===e.state).sort((e,t)=>e.due.getTime()-t.due.getTime()).slice(0,5),N={cook:'START COOKING',bag:'BAG IT',ready:'READY'};return(0,O.jsxs)(o.default,{style:{gap:12},children:[(0,O.jsx)(i.Button,{testID:"take-order",label:"Take an order",sub:(0,p.orderAtTableOn)(t)?'(phone, walk-in or table)':'(phone or walk-in takeaway)',accessibilityLabel:(0,p.orderAtTableOn)(t)?'Take an order, phone, walk-in or table':'Take an order, phone or walk-in takeaway',style:{minHeight:64},onPress:()=>h(!0)}),(0,O.jsx)(R.TakeawayPause,{r:t}),b?(0,O.jsx)(i.Banner,{kind:"success",title:`Order ${b} sent to the kitchen`,children:"It is on the live board below."}):null,(0,O.jsx)(i.Row,{gap:8,children:[['new','acknowledged'],['preparing'],['ready']].map((e,t)=>(0,O.jsxs)(o.default,{style:{flex:1,backgroundColor:j.colours.surface,borderRadius:12,padding:10,borderWidth:1,borderColor:j.colours.border},children:[(0,O.jsx)(i.T,{size:12,colour:j.colours.muted,children:['New','Preparing','Ready'][t]}),(0,O.jsx)(i.T,{size:22,weight:"bold",colour:[j.colours.red,j.colours.amber,j.colours.ok][t],children:n.filter(t=>e.includes(t.status)).length})]},t))}),(0,O.jsx)(k.SectionHead,{title:"Collection readiness",sub:`Takeaway timings: slot \u2212 prep \u2212 ${t.settings.bufferMins} min buffer`}),0===P.length?(0,O.jsx)(i.Muted,{children:"Nothing due right now."}):null,P.map(e=>(0,O.jsxs)(k.AlertBox,{colour:'overdue'===e.state?j.colours.red:j.colours.amber,title:`${N[e.stage]} \xb7 ${e.order.ref} \xb7 pickup ${(0,x.hm)(new Date(e.order.slotTime))}${'overdue'===e.state?' \xb7 OVERDUE':''}`,children:[(0,O.jsx)(i.T,{size:14,children:e.detail}),'ready'===e.stage?(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Mark ready (notify customer)",onPress:()=>u.repo.orders.setStatus(e.orderId,'ready',s)}):(0,O.jsx)(i.Button,{small:!0,label:'cook'===e.stage?'Started cooking':'Bagged & checked',disabled:!!(0,S.statusBlock)(e.order,'preparing',(0,S.linkedBooking)(e.order,u.useStore.getState().bookings)),onPress:()=>u.repo.orders.acknowledgeReadiness(e.orderId,e.stage,s)})]},e.id)),$.map(e=>(0,O.jsxs)(i.Muted,{children:[(0,x.hm)(e.due)," \xb7 ",N[e.stage]," \xb7 ",e.order.ref," (pickup ",(0,x.hm)(new Date(e.order.slotTime)),")"]},e.id)),(0,O.jsx)(k.SectionHead,{title:"Live orders",right:(0,O.jsx)(i.Row,{gap:4,children:((0,p.orderAtTableOn)(t)?['all','takeaway','table']:['all','takeaway']).map(e=>(0,O.jsx)(i.Chip,{label:'all'===e?'All':'takeaway'===e?'Takeaway':'Table',selected:f===e,onPress:()=>T(e)},e))})}),0===C.length?(0,O.jsx)(i.Muted,{children:"No live orders."}):null,C.map(e=>(0,O.jsx)(M,{o:e},e.id)),(0,O.jsx)(R.TakeawayMenuList,{me:s}),v.length?(0,O.jsx)(k.SectionHead,{title:"Recently completed"}):null,v.map(e=>(0,O.jsx)(i.Card,{style:{opacity:.7},children:(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]})},e.id)),c?(0,O.jsx)(A,{onClose:e=>{h(!1),e&&y(e)}}):null]})};var e,t=_r(d[0]),l=_r(d[1]),a=_r(d[2]),s=_r(d[3]),r=_r(d[4]),n=_r(d[5]),o=(e=n)&&e.__esModule?e:{default:e},i=_r(d[6]),u=_r(d[7]),c=_r(d[8]),p=_r(d[9]),h=_r(d[10]),b=_r(d[11]),m=_r(d[12]),y=_r(d[13]),x=_r(d[14]),j=_r(d[15]),k=_r(d[16]),w=_r(d[17]),f=_r(d[18]),T=_r(d[19]),S=_r(d[20]),C=_r(d[21]),v=_r(d[22]),B=_r(d[23]),R=_r(d[24]),O=_r(d[25]);const P={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff (table)','table-qr':'Table QR'};function A({onClose:e}){const{rid:a,r:s,now:n,me:m}=(0,w.useCtx)(3e4),x=(0,c.useAllMenu)(a).filter(e=>!e.hidden&&null!=e.price),k=(0,u.useOrders)(a),[T,S]=(0,r.useState)('phone'),[C,B]=(0,r.useState)(''),[R,P]=(0,r.useState)(''),[A,M]=(0,r.useState)(null),[$,N]=(0,r.useState)({}),[I,L]=(0,r.useState)([]),[D,E]=(0,r.useState)(''),[z,_]=(0,r.useState)(''),[F,G]=(0,r.useState)(''),[H,V]=(0,r.useState)(s.sections[0]??'All'),q=(0,y.takeawaySlots)(s,k,n).filter(e=>!e.full).slice(0,8),K=Object.entries($).filter(([,e])=>e>0),W=K.reduce((e,[t,l])=>e+(x.find(e=>e.id===t)?.price??0)*l,0),Q='staff-table'===T,U=(0,v.guestPhone)(z),Y=Q||('phone'===T?U.ok:!z.trim()||U.ok)&&(0,v.emailOk)(F),J=K.length>0&&Y&&(Q?R.trim().length>0:C.trim().length>1&&('walk-in'===T||A)),X=s.sections.length?s.sections:Array.from(new Set(x.map(e=>e.section)));return(0,O.jsxs)(i.Sheet,{visible:!0,onClose:()=>e(),title:"Take an order",children:[(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,O.jsx)(i.Chip,{label:"Phone takeaway",selected:'phone'===T,onPress:()=>S('phone')}),(0,O.jsx)(i.Chip,{label:"Walk-in takeaway",selected:'walk-in'===T,onPress:()=>S('walk-in')}),(0,p.orderAtTableOn)(s)?(0,O.jsx)(i.Chip,{label:"Table",selected:Q,onPress:()=>S('staff-table')}):null]}),Q?(0,O.jsx)(i.Field,{label:"Table number",value:R,onChangeText:P,keyboardType:"number-pad",placeholder:"e.g. 6"}):(0,O.jsx)(i.Field,{label:"Customer name",value:C,onChangeText:B,placeholder:"e.g. Mrs Reid"}),Q?null:(0,O.jsx)(i.Field,{label:'phone'===T?'Mobile or phone number (needed)':'Mobile number (optional, for a text when it\u2019s ready)',value:z,onChangeText:_,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123"}),Q||!z||U.ok?null:(0,O.jsx)(i.T,{size:13,colour:j.colours.amber,children:U.error}),Q?null:(0,O.jsx)(i.Field,{label:"Email (optional)",value:F,onChangeText:G,keyboardType:"email-address",autoCapitalize:"none",placeholder:"CoverCharge confirms by email"}),'phone'===T?(0,O.jsxs)(o.default,{style:{gap:4},children:[(0,O.jsxs)(i.Muted,{children:["Collection slot (cap ",s.settings.slotCap," per ",s.settings.slotMinutes," min)"]}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:q.map(e=>(0,O.jsx)(i.Chip,{label:e.label,sub:e.cap-e.taken+" left",selected:A===e.time.toISOString(),onPress:()=>M(e.time.toISOString())},e.label))}),q.length?null:(0,O.jsx)(i.Muted,{children:"No slots left today."})]}):null,(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:X.map(e=>(0,O.jsx)(i.Chip,{label:e,selected:H===e,onPress:()=>V(e)},e))}),x.filter(e=>e.section===H||!X.includes(e.section)).map(e=>(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between',opacity:e.soldOut?.4:1},children:[(0,O.jsxs)(o.default,{style:{flex:1},children:[(0,O.jsx)(i.T,{size:15,children:e.name}),(0,O.jsxs)(i.Muted,{children:[(0,b.gbp)(e.price??0),e.soldOut?' \xb7 sold out':'']})]}),e.soldOut?null:(0,O.jsx)(i.Stepper,{value:$[e.id]??0,min:0,max:20,label:e.name,onChange:t=>N({...$,[e.id]:t})})]},e.id)),(0,O.jsx)(i.Muted,{children:"Allergies (ask every customer)"}),(0,O.jsx)(i.Row,{wrap:!0,gap:6,children:h.ALLERGENS.map(e=>{const t=I.some(t=>t.allergen===e.id);return(0,O.jsx)(i.Chip,{label:e.short,selected:t,onPress:()=>L(t?I.filter(t=>t.allergen!==e.id):[...I,{allergen:e.id,severity:'allergy'}])},e.id)})}),(0,O.jsx)(i.Field,{label:"Notes",value:D,onChangeText:E,placeholder:"e.g. extra salt, call on arrival"}),t.IS_GREENSIDE?(0,O.jsx)(l.GreensideCashOnly,{}):(0,O.jsx)(i.Banner,{kind:"demo",title:"Phone and walk-in orders: pay at the bar",children:"Take payment on the till. Online guest orders are paid by card on the website before they reach you."}),(0,O.jsx)(i.Button,{label:`Place order \xb7 ${(0,b.gbp)(W)}`,disabled:!J,onPress:()=>{const t=u.useStore.getState().placeManualOrder({restaurantId:a,type:Q?'table':'takeaway',channel:T,customerName:C.trim(),tableNo:Q?R.trim():void 0,slotTime:'phone'===T?A:'walk-in'===T?new Date(n.getTime()+9e5).toISOString():void 0,lines:K.map(([e,t])=>({itemId:e,qty:t})),allergies:I,notes:D.trim()||void 0,by:m,phone:!Q&&U.ok?U.pretty:void 0,email:Q?void 0:F.trim()||void 0});I.length&&(0,f.autoPost)('kitchen',`Allergy alert ${Q?`table ${R.trim()}`:t.ref}: ${I.map(e=>(0,h.allergenLabel)(e.allergen).toLowerCase()).join(', ')}`),e(t.ref)}})]})}function M({o:e}){const{r:t,now:l,me:r}=(0,w.useCtx)(1e4),n=(0,k.nextStatus)(e),c=(0,u.useStore)(e=>e.bookings),p=(0,S.linkedBooking)(e,c),m=e.allergies.length>0&&!!(0,S.nextStep)(e,p)&&!('table'===(0,S.nextStep)(e,p)&&!['ready','served'].includes(e.status)),y=!!n&&!!(0,S.statusBlock)(e,n.to,p);return(0,O.jsxs)(o.default,{style:[i.styles.card,{borderColor:m?j.colours.red:'new'===e.status?j.colours.amber:j.colours.border}],children:[(0,O.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,O.jsxs)(i.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,a.tableNumbers)(e.tableNo)}`:e.customerName]}),(0,O.jsx)(i.Badge,{kind:(0,k.statusKind)(e.status),label:(0,k.statusLabel)(e)})]}),(0,B.paidBadge)(e)?(0,O.jsx)(i.Badge,{kind:"ok",label:(0,B.paidBadge)(e)}):null,(0,O.jsxs)(i.Muted,{children:['takeaway'===e.type?"Takeaway"+(e.slotTime?` \xb7 pickup ${(0,x.hm)(new Date(e.slotTime))}`:''):'Dine-in'," \xb7 ",P[e.channel??(e.type,'app')]," \xb7 ",(0,x.minsBetween)(new Date(e.createdAt),l)," min ago \xb7 ",(0,b.gbp)(e.total),e.paid>=e.total?' paid':' unpaid']}),e.lines.map((e,t)=>(0,O.jsxs)(i.T,{size:14,children:[e.qty,"\xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 ${e.notes}`:'']},t)),e.notes?(0,O.jsxs)(i.Muted,{children:["Note: ",e.notes]}):null,e.allergies.length?(0,O.jsx)(i.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,O.jsx)(i.Badge,{kind:"red",label:`${(0,h.allergenLabel)(e.allergen)} \xb7 ${(0,h.severityLabel)(e.severity)}`},e.allergen))}):null,e.allergies.length?(0,O.jsx)(T.AllergyChain,{o:e,me:r}):null,e.accepted?(0,O.jsxs)(i.T,{size:13,colour:j.colours.ok,children:["Accepted by ",e.accepted.by,e.readyBy?` \xb7 ready by ${(0,x.hm)(new Date(e.readyBy))}`:'']}):null,'takeaway'===e.type?(0,O.jsx)(C.ConfirmTimeline,{refId:e.id}):null,'takeaway'===e.type?(0,O.jsx)(s.ReprintButton,{rid:t.id,o:e}):null,e.customerSignal?(0,O.jsx)(i.Badge,{kind:"blue",label:'here'===e.customerSignal?'Customer is here':'Customer on the way'}):null,(0,O.jsxs)(i.Row,{wrap:!0,gap:6,children:[n?(0,O.jsx)(i.Button,{small:!0,kind:'ready'===n.to?'success':'primary',label:n.label,testID:`next-${e.ref}`,disabled:y,onPress:()=>u.repo.orders.setStatus(e.id,n.to,r)}):null,'takeaway'!==e.type||'new'!==e.status||e.accepted?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i.Button,{small:!0,kind:"success",label:"Accept",onPress:()=>u.repo.orders.accept(e.id,r)}),[15,20,30].map(t=>(0,O.jsx)(i.Button,{small:!0,kind:"secondary",label:`Ready in ${t}`,onPress:()=>u.repo.orders.accept(e.id,r,t)},t))]}),'new'===e.status?(0,O.jsx)(i.Button,{small:!0,kind:"ghost",label:'paid'===e.payment?.state?'Reject (then refund it in the website\u2019s Orders)':'Reject',onPress:()=>u.repo.orders.setStatus(e.id,'cancelled',r)}):null]})]})}},1486,[805,1421,843,1395,17,85,777,858,860,866,845,851,1160,1105,863,804,1184,1057,1161,1162,853,1427,848,900,1487,8]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TakeawayPause=function({r:e}){const a=!!e.settings.takeawayPaused;return(0,u.jsx)(l.Card,{highlight:a?r.colours.red:void 0,children:(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsx)(l.T,{weight:"semibold",children:a?'Takeaway is PAUSED':'Taking online takeaway orders'}),(0,u.jsx)(l.Muted,{children:a?'Guests can\u2019t place new orders. Orders already paid still need cooking.':'Paid orders arrive here and on the Head Chef\u2019s, GM\u2019s and the kitchen team\u2019s phones.'})]}),(0,u.jsx)(l.Toggle,{testID:"takeaway-pause",label:a?'Resume':'Pause',value:!a,onChange:a=>t.useStore.getState().updateSettings(e.id,{takeawayPaused:!a})})]})})},_e.TakeawayMenuList=function({me:e}){const[s,t]=(0,a.useState)(!1),c=(0,o.useStaffTakeaway)(e=>e.rows),h=(0,o.useStaffTakeaway)(e=>e.canSet),f=(0,o.useStaffTakeaway)(e=>e.busy),w=(0,o.useStaffTakeaway)(e=>e.error),y=(0,o.useStaffTakeaway)(e=>e.loadedAt);(0,a.useEffect)(()=>{s&&(0,o.loadStaffTakeaway)(!0)},[s]);const k=c?Object.values(c).sort((e,a)=>e.section.localeCompare(a.section)||e.dish.localeCompare(a.dish)):null,j=k?.filter(e=>e.onMenu).length??0,x=y>0&&null===c;return(0,u.jsxs)(l.Card,{children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(l.T,{weight:"semibold",children:["Takeaway menu",k?` \xb7 ${j} of ${k.length} available`:'']}),(0,u.jsx)(l.Button,{small:!0,kind:"secondary",label:s?'Hide':'Choose dishes',onPress:()=>t(!s),testID:"takeaway-menu"})]}),s?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(l.Muted,{children:"The whole menu shows on the takeaway page. Switch off what can\u2019t be done for takeaway today: guests see it as \u201cNot available for takeaway today\u201d. A dish also needs Head Chef allergen sign-off and a price."}),!h&&k?(0,u.jsx)(l.Muted,{children:"Only the Head Chef, a manager or an owner can change this."}):null,x?(0,u.jsx)(l.Banner,{kind:"warn",children:"Connect to the venue to see the takeaway menu."}):null,w?(0,u.jsx)(l.Banner,{kind:"warn",children:w}):null,k||x||w?null:(0,u.jsx)(l.Muted,{children:"Loading\u2026"}),(k??[]).map(a=>(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(n.default,{style:{flex:1},children:[(0,u.jsxs)(l.T,{size:14,children:[a.dish,a.pricePence?` \xb7 ${(0,d.gbp)(a.pricePence)}`:'']}),(0,u.jsxs)(l.Row,{gap:4,children:['Specials board'===a.section?(0,u.jsx)(l.Badge,{kind:"gold",label:"Special"}):null,a.soldOut?(0,u.jsx)(l.Badge,{kind:"neutral",label:"Sold out"}):null,a.signedOff?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"Not signed off"}),a.pricePence?null:(0,u.jsx)(l.Badge,{kind:"amber",label:"No price"})]})]}),h?(0,u.jsx)(l.Toggle,{label:"Available for takeaway",a11y:`Available for takeaway, ${a.dish}`,value:a.onMenu,disabled:f===a.itemId,onChange:s=>{(0,o.setTakeawayAvailable)(a.itemId,s,e).catch(()=>{})}}):(0,u.jsx)(l.T,{size:14,colour:a.onMenu?r.colours.gold:r.colours.muted,children:a.onMenu?'Available':'Not today'})]},a.itemId))]}):null]})};var e,a=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=_r(_d[2]),t=_r(_d[3]),d=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),u=_r(_d[7])},1487,[17,85,777,858,851,1159,804,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"tableOnHere",{enumerable:!0,get:function(){return Ce}});var e,t=_r(d[0]),s=_r(d[1]),r=_r(d[2]),o=_r(d[3]),n=_r(d[4]),u=_r(d[5]),l=_r(d[6]),c=_r(d[7]),p=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]),y=_r(d[12]),C=_r(d[13]),S=_r(d[14]),k=_r(d[15]),w=_r(d[16]),v=_r(d[17]),P=_r(d[18]),R=_r(d[19]),A=_r(d[20]),T=_r(d[21]),I=_r(d[22]),M=_r(d[23]),G=_r(d[24]),O=_r(d[25]),E=_r(d[26]),B=_r(d[27]),x=_r(d[28]),D=_r(d[29]),N=_r(d[30]),L=(e=N)&&e.__esModule?e:{default:e},_=_r(d[31]),H=_r(d[32]),q=_r(d[33]),Q=_r(d[34]),F=_r(d[35]),U=_r(d[36]),V=_r(d[37]),W=_r(d[38]),Y=_r(d[39]),j=_r(d[40]),z=_r(d[41]),K=_r(d[42]),$=_r(d[43]),J=_r(d[44]),X=_r(d[45]),Z=_r(d[46]),ee=_r(d[47]),te=_r(d[48]),se=_r(d[49]),ae=_r(d[50]),ie=_r(d[51]),re=_r(d[52]),oe=_r(d[53]),ne=_r(d[54]),ue=_r(d[55]),le=_r(d[56]),ce=_r(d[57]),de=_r(d[58]),ge=_r(d[59]),pe=_r(d[60]),he=_r(d[61]),be=_r(d[62]),fe=_r(d[63]),ye=_r(d[64]);const Ce=()=>{const e=n.useOwner.getState().site;return(0,p.orderAtTableOn)(c.useStore.getState().restaurants.find(t=>t.id===e))},me=e=>n.CAN.manage(e);(0,y.register)([{id:'chat',title:'Staff chat',sub:'Messages with the team on this venue',group:'Start here',can:me,C:v.Chat},{id:'lookback',title:'Look back',sub:'Bookings on one exact past date: times, party sizes, recorded tables and Booked covers',group:'Run the day',can:e=>me(e)&&'owner'===r.APP_VARIANT,C:s.LookBack},{id:'orders',title:'Orders',sub:'Live takeaway and table orders, allergy sign-offs',group:'Run the day',can:me,C:O.Orders},{id:'forecasts',title:'Forecasts',sub:'Covers for the days ahead, busy levels and prep from the forecast',group:'Run the day',can:n.CAN.forecasts,C:P.Forecasts},{id:'serviceboard',title:'Restaurant dashboard',sub:'The Display in Managers: any day, plan, Timeline, guests, Covers and all service actions',group:'Run the day',can:me,C:o.ServiceBoard},{id:'vouchers',title:'Gift vouchers',sub:'Website vouchers: search, use by dates, mark as used (one time, nothing left)',group:'Run the day',can:e=>me(e)&&!r.IS_CAR,C:T.WebsiteVouchersPage},{id:'info',title:'Info & hours',sub:'Tagline, phone, about, kitchen hours',group:'Manage app',can:me,C:f.InfoHours},{id:'photos',title:'Photos',sub:'Gallery shown in the customer app',group:'Manage app',can:me,C:f.Photos},{id:'recipecards',title:'Recipe cards',sub:'Photo, ingredients, method, allergens, section and price; head chef signs off',group:'Manage app',C:k.RecipeCardsPage},{id:'menu',title:'Menu & allergens',sub:'Add, hide, mark sold out, descriptions and options; allergens come from the recipe cards',group:'Manage app',can:me,C:f.MenuManager},{id:'offers',title:'Specials & offers',sub:'Live specials; notifications are not connected',group:'Manage app',can:me,C:f.Offers},{id:'events',title:'Events',sub:"What's on, feeds the forecast",group:'Manage app',can:me,C:f.EventsPage},{id:'feedback',title:'Feedback inbox',sub:'Private ratings after each visit',group:'Manage app',can:me,C:f.Feedback},{id:'staff',title:'Staff & roles',sub:'Team, roles and role preview',group:'Team',C:h.StaffRoles},{id:'branding',title:'Branding',sub:'Your logo and accent colour in all five apps',group:'Account',can:me,C:S.BrandingSettings},{id:'plan',title:'Plan & billing',sub:b.PLAN_SUB,group:'Account',can:n.CAN.billing,C:b.PlanBilling}]),(0,y.register)([{id:'avatar',title:'My avatar',sub:'Original icons, Bar & kitchen, animals, sea, sport, patterns or your own photo',group:'Team',C:E.MyAvatar},{id:'clock',title:'Clock in / out',sub:'Geofenced, break prompt, privacy-first',group:'Team',C:M.ClockInOut},{id:'rota',title:'Rota',sub:'Shift builder, swaps, leave, availability, labour vs forecast',group:'Team',C:M.Rota},{id:'signoff',title:'Sign off hours',sub:'Rostered vs actual, flags, fix times, confirm hours for pay',group:'Team',can:me,C:G.SignOff},{id:'timesheets',title:'Timesheets',sub:'Scheduled vs actual, breaks, paid hours, payroll export',group:'Team',C:M.Timesheets}]),(0,y.register)([{id:'bizinsights',title:'Business insights',sub:'Stats and percentages from your bookings, cash ups and rota',group:'Run the day',can:me,C:x.BusinessInsights},{id:'insights',title:'Insights',sub:'Smart suggestions from your data',group:'Run the day',can:n.CAN.forecasts,badge:'AI',C:B.Insights},{id:'prep',title:'Prep & stock list',sub:'What to prep from tonight\u2019s forecast',group:'Run the day',C:B.PrepList},{id:'blocks',title:'Block bookings',sub:'Block now, add a block for a future date, time, area or tables, and see every future block',group:'Run the day',can:me,C:R.BlocksPage},{id:'spendhead',title:'Spend per head',sub:'Takings \xf7 covers by day, week and service, from your cash ups',group:'Run the day',can:me,C:A.SpendPerHeadPage},{id:'cashup',title:'Cash up & sales',sub:'End-of-night cash up, paid outs, weekly sales report, graphs, Today\u2019s tips and the Tips pot',group:'Run the day',can:me,C:w.CashUpPage},{id:'notifications',title:'Notifications',sub:'Orders, allergies, requests, reviews',group:'Run the day',C:B.Notifications},{id:'search',title:'Search',sub:'Dishes, orders, bookings, customers, staff',group:'Run the day',C:B.Search},{id:'analytics',title:'Sales & analytics',sub:'Revenue by channel, top dishes, commission saved',group:'Grow',can:n.CAN.takings,C:B.Analytics},{id:'engineering',title:'Menu engineering',sub:'Margin vs popularity, sold out toggle',group:'Grow',can:me,C:B.MenuEngineering},{id:'crm',title:'Customers (CRM)',sub:'Profiles, visits, allergies, tags, segments',group:'Grow',can:me,C:B.Crm},{id:'marketing',title:'Marketing',sub:'Saved campaign drafts; delivery is not connected',group:'Grow',can:me,C:B.Marketing},{id:'reviews',title:'Reviews',sub:'Look through reviews, publish or remove with a recorded reason',group:'Grow',can:me,C:B.Reviews},{id:'reviewemail',title:'Review emails',sub:'Ask guests for a review after their visit',group:'Settings',can:me,C:B.ReviewEmailSettings},{id:'lost',title:'Lost property & coat check',sub:'Found items and coat-check tickets',group:'Compliance',C:B.LostProperty},{id:'apps',title:'Your apps',sub:'Links to all five apps (customer, Staff, Display, Head Chef, Managers)',group:'Account',can:me,C:B.YourApps},{id:'demo',title:'Example data',sub:'Example service time, reset',group:'Account',can:()=>!t.LIVE_VENUE_BUILD,C:B.DemoTools}]),(0,y.register)([{id:'features',title:'All features',sub:'Every CoverCharge feature, one tap away',group:'Start here',badge:'19',C:D.AllFeatures},{id:'tables',title:'Tables & QR codes',sub:'QR order & pay at table, live table orders',group:'Run the day',can:()=>Ce(),C:D.TablesQr},{id:'takeaway',title:'Takeaway settings',sub:'Slots, capacity, pause, live queue',group:'Run the day',can:me,C:D.TakeawaySettings},{id:'bookingsettings',title:'Booking settings',sub:'Deposits, reminders',group:'Run the day',can:me,C:D.BookingSettings},{id:'allergy',title:'Allergy hub',sub:'14 allergens, alerts, verification, audit log',group:'Compliance',C:D.AllergyHub},{id:'loyalty',title:'Stamp card',sub:'Settings, members, add/redeem stamps, stats',group:'Grow',can:me,C:D.Loyalty},{id:'referrals',title:'Bring a friend',sub:'Referral rewards, list and stats',group:'Grow',can:me,C:D.Referrals},{id:'giftcards',title:'Gift cards & vouchers',sub:'Sell, balance, redeem, honour website bookings cards',group:'Grow',can:me,C:D.GiftVouchers},{id:'merch',title:'Merch shop',sub:'Optional: products, stock, orders',group:'Grow',can:me,C:D.Merch},{id:'tablet',title:'Staff tablet preview',sub:'Tablet app coming later',group:'Account',C:D.TabletPreview}]);const Se=e=>'staff'!==e;(0,y.register)([{id:'mypay',title:'My hours & pay',sub:'Hours worked and gross pay, before tax (estimate)',group:'Team',C:()=>L.default.createElement(H.MyHoursPay)},{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips',group:'Team',C:_.MyTips},{id:'tips',title:'Tips',sub:'Split tips fairly, approve, compliance checklist',group:'Team',can:Se,C:_.Tips},{id:'payroll',title:'Payroll & pay rates',sub:'Hourly rates, team gross pay for the period',group:'Team',can:Se,C:H.Payroll},{id:'suppliers',title:'Suppliers',sub:'Contacts, cut-offs, call, email, order log',group:'Run the day',can:e=>'staff'!==e||n.useOwner.getState().staffCanViewSuppliers,C:q.Suppliers}]),(0,y.register)([{id:'social',title:'Post to social',sub:'Publishing is not connected',group:'Grow',C:Q.SocialPage},{id:'socialaccounts',title:'Social posting accounts',sub:'No social publishing accounts are connected',group:'Grow',can:me,C:Q.SocialAccounts},{id:'quicklinks',title:'Quick links',sub:'Work email (Gmail), website bookings and your own shortcuts',group:'Account',can:me,C:Q.QuickLinksSettings}]),(0,y.register)([{id:'tableplan',title:'Table plan',sub:'Areas, tables, seats, joins; used by the Display floor view',group:'Run the day',can:me,C:F.TablePlan},{id:'displaysettings',title:'Display settings',sub:'Privacy mode, screensaver, PIN on wake',group:'Run the day',can:me,C:F.DisplaySettingsPage}]);const ke=e=>'owner'===e||'manager'===e;U.ASSISTANT_AVAILABLE&&V.ASSISTANT_UI&&(0,y.register)([{id:'assistant',title:'Assistant',sub:'Ask in plain English; you confirm every action. Activity log',group:'Start here',can:ke,C:U.AssistantPage},{id:'assistantsettings',title:'Assistant settings',sub:'On/off and connected services',group:'Account',can:ke,C:U.AssistantSettings}]),(0,y.register)([{id:'carscreen',title:'Car screen',sub:'Sign the car in with its 6-digit code, or sign a car out. Parked only',group:'Run the day',can:e=>'owner'===e&&!r.IS_CAR,C:Y.CarScreen}]),(0,y.register)([{id:'assistants',title:'Assistants',sub:'Pair your own AI assistant with a 6-digit code, switch it off, or unpair it',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantsPage}]),(0,y.register)([{id:'assistant-requests',title:'Assistant requests',sub:'Confirm or decline changes your assistant has proposed',group:'Start here',can:e=>'owner'===e&&!r.IS_CAR,C:j.AssistantRequestsPage}]);const we=e=>'owner'===e||'manager'===e,ve=e=>'owner'===e;(0,y.register)([{id:'superpro-insights',title:'Insights',sub:'Every owner metric in one place: sales, stock, GP, clock-in changes, bookings, orders, reviews, loyalty and wages',group:'Run the day',can:ve,C:I.SuperProInsightsPage},{id:'insights-sales',title:'Insights: Sales',sub:'SuperPro \xb7 takings by week, last 7 days against the 7 before, spend per head',group:'Run the day',can:ve,C:I.InsightsSalesPage},{id:'insights-stock',title:'Insights: Stock',sub:'SuperPro \xb7 low at the last count (par levels) and recent price rises',group:'Run the day',can:ve,C:I.InsightsStockPage},{id:'insights-gp',title:'Insights: GP',sub:'SuperPro \xb7 menu and dish GP over time, and dishes whose GP fell after a cost change',group:'Run the day',can:ve,C:I.InsightsGpPage},{id:'insights-clock',title:'Insights: Clock-in changes',sub:'SuperPro \xb7 who edited which shift, when, before and after, and edits not signed off',group:'Run the day',can:ve,C:I.InsightsClockPage}]);const Pe=()=>{const e=u.useSession.getState().meId;if(!e)return!0;const t=n.useOwner.getState().staff.find(t=>t.id===e);return!!t&&t.active&&(0,l.costsAllowedFor)(t)},Re=e=>we(e)&&Pe();(0,y.register)([{id:'specialsboard',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app',group:'Run the day',can:we,C:W.SafetyPages.Specials},{id:'dishcreator',title:'New dish creator',sub:'Cost a dish, set GP % or multiple, price it, publish to the menu',group:'Manage app',can:Re,C:W.SafetyPages.Creator},{id:'kitchencosts',title:'Deliveries, stock & GP',sub:'Scan or type deliveries, count stock, see every dish\u2019s GP and GP over time',group:'Manage app',can:Re,C:W.SafetyPages.Kitchen},{id:'ingredientprices',title:'Ingredient prices',sub:'What you pay per pack and what it averages; recipe cards work out their GP from it',group:'Manage app',can:Re,C:W.SafetyPages.Prices},{id:'haccp',title:'CookSafe log',sub:'One food safety log on every device: temperatures, deliveries, reheating, cleaning, training, House Rules, allergen matrix, inspector export',group:'Compliance',can:we,C:W.SafetyPages.Haccp},{id:'compliance',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'foodsafety',title:'CookSafe log',sub:'Opens the CookSafe log',group:'Retired',can:we,C:W.SafetyPages.Haccp},{id:'allergen-signoffs',title:'Allergen sign-off log',sub:'Five-step sign-off chain for every guest allergy, with names and times',group:'Compliance',can:we,C:C.AllergenSignOffLog},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; RIDDOR prompt for serious ones',group:'Compliance',C:W.SafetyPages.Accidents}]),(0,y.register)([{id:'alerts',title:'Alerts & sounds',sub:'Live alerts, chime, which alerts, test alert, phone notifications',group:'Run the day',can:me,C:z.AlertSettings},{id:'guestmsgs',title:'Guest texts & emails',sub:'Booking and order confirmations, with live preview',group:'Manage app',can:me,C:z.GuestTemplates},{id:'outbox',title:'Outbox',sub:'Every guest text and email (preview mode)',group:'Run the day',can:me,C:z.Outbox}]);const Ae=e=>'owner'===e||'manager'===e;(0,y.register)([{id:'bookingrules',title:'Online booking rules',sub:'Party sizes, large groups, areas, dogs, table requests, access, deposits and pre-orders, email, allergies',group:'Settings',can:Ae,C:J.OnlineBookingRulesPage},{id:'optins',title:'Marketing opt-ins',sub:'Guests who ticked the marketing box (UK GDPR and PECR). Nothing is sent',group:'Grow',can:J.optinsAllowed,C:J.MarketingOptInsPage},{id:'advanced',title:'Advanced',sub:'Bookings questions, table times, platters, regular events, kitchen hours and seasons, home screens',group:'Settings',can:Ae,C:$.AdvancedSettings},{id:'setup',title:'Guided setup',sub:'Nine steps with a progress bar: venue, hours, table plan, pay, staff, permissions, links',group:'Settings',can:Ae,C:K.SetupGuide},{id:'orderattable',title:'Order at table',sub:'On or off for this venue: QR order & pay at table. Takeaway is separate',group:'Settings',can:Ae,C:X.OrderAtTableSettings},{id:'ordersheets',title:'Supplier order sheets',sub:'Suppliers, delivery days, cut-offs and how to order; used by the Head Chef app',group:'Settings',can:Ae,C:Z.OrderSheetSettings},...ee.SETUP_STEPS.flatMap(e=>[{id:`setup-${e.id}`,title:e.title,sub:e.sub,group:'Settings',can:Ae,C:(0,K.stepPage)(e.id)},...'venue'===e.id?[{id:'screensaver',title:'Display screensaver',sub:'What the Display shows when it\'s idle',group:'Settings',can:Ae,C:te.DisplaySaverSettings}]:[]])]),(0,y.register)([{id:'displays',title:'Displays',sub:'Pair a tablet with a one-time code, or switch one off',group:'Settings',can:Ae,C:se.DisplaysPage},{id:'trackedstock',title:'Tracked stock',sub:'Live counters (lobster, crab or anything else): units, low warning, supplier',group:'Settings',can:me,C:se.TrackedStockPage},{id:'breakroom',title:'Break room game',sub:'On or off for the team',group:'Settings',can:Ae,C:se.BreakRoomSettings}]),(0,y.register)([{id:'tableqr',title:'Table QR codes',sub:'Scan to order: on or off, hours, print and renew each table\'s QR',group:'Run the day',can:Ae,C:ae.TableQrPage}]),(0,y.register)([{id:'hours',title:'Payroll hours',sub:'Confirmed hours per person for a pay or tips period; copy into your spreadsheet, CSV or print',group:'Team',can:me,C:ie.PayrollHours},{id:'tipsday',title:'Tips day',sub:'Enter the total; it\u2019s shared by confirmed hours to the penny',group:'Team',can:me,C:ie.TipsDay},{id:'paysettings',title:'Pay & tips',sub:'Tips payday and frequency, wage pay day and cut-off',group:'Settings',can:me,C:ie.PayTipsSettings}]),(0,y.register)([{id:'setupchecklist',title:'Setup checklist',sub:'Your setup progress, replay the welcome, questionnaire answers',group:'Settings',can:me,C:re.SetupChecklist}]),(0,y.register)([{id:'help',title:'Help & tutorials',sub:'Search how-tos and Show me where',group:'Start here',can:me,C:oe.HelpPage}]),(0,y.register)([{id:'connections',title:'Connected accounts',sub:'Email, website, work socials, bookings, payments, accounting and supplier links',group:'Settings',can:me,C:ue.ConnectionsPage}]),(0,y.register)([{id:'drafts',title:'Drafts for approval',sub:'Bookings, supplier lists, offers, events and specials waiting for a yes; nothing is sent',group:'Run the day',can:me,C:le.DraftsPage},{id:'shiftnotes',title:'Shift notes',sub:'Notes for the next shift',group:'Run the day',C:le.ShiftNotesPage}]),(0,y.register)([{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, history',group:'Run the day',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ce.OrderListsScreen,{rid:e,today:r,editor:'staff'!==t,who:{id:o?.id??'manager',name:(o?.name??s).replace(' (example)','')}})}}]),(0,y.register)([{id:'board',title:'Question board',sub:'Anonymous questions from the team: vote, reply, hide (logged)',group:'Team',C:function(){const{rid:e,role:t,me:s,today:r}=(0,de.useCtx)(6e4),o=(0,de.useSignedIn)();return L.default.createElement(ge.QuestionBoard,{rid:e,today:r,manager:'owner'===t||'manager'===t,by:(o?.name??s).replace(' (example)','')})}},{id:'morale',title:'Team morale',sub:'Morale over time, staffing vs Covers each night, shout-outs. Anonymous',group:'Team',can:we,C:function(){const{rid:e,today:t}=(0,de.useCtx)(6e4);return L.default.createElement(ge.MoraleTrend,{rid:e,today:t})}}]),(0,y.register)([{id:'soldout',title:'Sold out',sub:'Mark dishes sold out or back on. A reminder for staff, shown on the Display',group:'Run the day',C:function(){const{rid:e,me:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(pe.SoldOutList,{rid:e,by:(s?.name??t).replace(' (example)','')})}}]),(0,y.register)([{id:'printerhelp',title:'Connect a ticket printer',sub:'Wi-Fi, network and Bluetooth printers for kitchen tickets, in plain words',group:'Start here',can:me,C:ne.PrinterHelpPage}]),(0,y.register)([{id:'guests',title:'Guest profiles',sub:'Visits and Covers from bookings, allergies checked with the guest, preferences, GDPR export and erase requests',group:'Grow',C:function(){const{me:e,role:t}=(0,de.useCtx)(6e4),s=(0,de.useSignedIn)();return L.default.createElement(he.GuestProfiles,{me:(s?.name??e).replace(' (example)',''),manager:'owner'===t||'manager'===t})}}]),(0,y.register)([{id:'nightly',title:'Nightly report',sub:'Spend per head, Covers, takings, tips and no-shows from the cash-up',group:'Run the day',can:me,C:be.NightlyReportPage}]),(0,y.register)([{id:'computer',title:'Use on a computer',sub:'Owners: sign in on a Mac or PC with a one-use link from this phone',group:'Account',can:e=>'owner'===e&&!r.IS_CAR&&!r.IS_OWNER_DESKTOP,C:ye.UseOnComputerPage}]),(0,y.register)([{id:'support',title:'Customer support',sub:'Send a message or a picture to CoverCharge',group:'Account',can:e=>'owner'===e&&!r.IS_CAR,C:fe.SupportChatPage}])},1488,[822,1050,856,1489,876,920,909,816,866,1491,1498,1500,1459,1501,1502,1504,1505,1161,1484,1506,1507,1508,1467,1202,1193,1486,1509,1457,1510,1511,17,1199,1182,1458,1446,1460,1516,1214,1522,1523,1473,1524,1449,1434,1525,1464,1526,886,1527,1528,1530,1188,1475,1531,1395,1477,1543,1081,1057,1203,1153,1547,1550,1553,1555]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DASH_SHORTCUTS",{enumerable:!0,get:function(){return D}}),_e.DashCorners=C,_e.ServiceBoard=function(){const{role:e}=(0,x.useCtx)(3e4),[o,f]=(0,t.useState)(!0),y=()=>f(!1);if((0,c.useBackLayer)(o&&b.CAN.manage(e),y),!b.CAN.manage(e))return(0,j.jsx)(l.Muted,{children:"The Restaurant dashboard is for managers and owners."});const p=(0,j.jsxs)(n.SafeAreaView,{style:{flex:1,backgroundColor:h.colours.bg},edges:['top','bottom','left','right'],children:[(0,j.jsx)(s.default,{style:{paddingHorizontal:12,paddingVertical:4,borderBottomWidth:1,borderColor:h.colours.gold},children:(0,j.jsx)(l.Button,{kind:"secondary",testID:"restaurant-dashboard-close",label:"Back to Managers",accessibilityLabel:"Close Restaurant dashboard, back to Managers",onPress:y,style:{minHeight:48}})}),(0,j.jsx)(C,{onLeave:y}),(0,j.jsx)(s.default,{style:{flex:1,minHeight:0},children:(0,j.jsx)(u.DisplayBoard,{embedded:!0})})]});return(0,j.jsxs)(s.default,{testID:"manager-restaurant-dashboard",style:{gap:10},children:[(0,j.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.goldLight,children:"The same live board as the Display"}),(0,j.jsx)(l.Muted,{children:"Pick any day. Table plan, Timeline, guests, deposits, dogs, joined tables, Covers, chart and block bookings. Today you can seat, finish, mark no-show or cancel a walk-in too."}),(0,j.jsx)(l.Button,{testID:"restaurant-dashboard-open",label:"Open Restaurant dashboard",accessibilityLabel:"Open Restaurant dashboard, the same table plan, Timeline, guests and Covers as the Display",onPress:()=>f(!0),style:{minHeight:56}}),o?I((0,j.jsx)(s.default,{testID:"restaurant-dashboard-layer",style:{position:'fixed',left:0,top:0,right:0,bottom:0,zIndex:50,backgroundColor:h.colours.bg},children:p})):null]})};var t=r(d[0]);r(d[1]),r(d[2]);var o=e(r(d[3])),s=e(r(d[4])),n=r(d[5]),l=r(d[6]),c=r(d[7]),u=r(d[8]),b=r(d[9]),h=r(d[10]),f=r(d[11]),y=r(d[12]),p=r(d[13]),x=r(d[14]),j=r(d[15]);const D=[{id:'home',tab:'home',icon:'home',label:'Home: today in Managers',side:'left'},{id:'bookings',tab:'bookings',icon:'bookings',label:'Bookings',side:'left'},{id:'rota',tab:'more',sub:'rota',icon:'clock',label:'Rota: shifts, swaps and leave',side:'right'},{id:'more',tab:'more',icon:'more',label:'More: every manager function',side:'right'}];function k({testID:e,icon:t,label:n,onPress:c,badge:u}){return(0,j.jsx)(o.default,{testID:e,accessibilityRole:"button",accessibilityLabel:n,onPress:c,style:({pressed:e})=>({width:44,height:44,borderRadius:12,backgroundColor:e?'rgba(201,162,74,0.30)':'rgba(201,162,74,0.16)',alignItems:'center',justifyContent:'center'}),children:(0,j.jsxs)(s.default,{children:[(0,j.jsx)(y.Icon,{name:t,colour:h.colours.gold}),u?(0,j.jsx)(s.default,{style:{position:'absolute',right:-7,top:-6,backgroundColor:h.colours.red,borderRadius:8,minWidth:16,height:16,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(l.T,{size:10,weight:"bold",children:u})}):null]})})}function C({onLeave:e}){const t=(0,p.useShellBadges)(e=>e.notifCount),o=(t,o)=>{e(),requestAnimationFrame(()=>f.useVoiceNav.getState().go?.(t,o??null))},n=e=>(0,j.jsx)(k,{testID:`dash-go-${e.id}`,icon:e.icon,label:e.label,onPress:()=>o(e.tab,e.sub)},e.id);return(0,j.jsxs)(s.default,{testID:"dash-corners",style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingHorizontal:12,paddingTop:6,paddingBottom:6,gap:4,borderBottomWidth:1,borderColor:h.colours.hairline},children:[(0,j.jsx)(s.default,{testID:"dash-corner-left",style:{flexDirection:'row',gap:4},children:D.filter(e=>'left'===e.side).map(n)}),(0,j.jsxs)(s.default,{testID:"dash-corner-right",style:{flexDirection:'row',gap:4,alignItems:'center'},children:[D.filter(e=>'right'===e.side).map(n),(0,j.jsx)(k,{testID:"dash-bell",icon:"bell",label:t?`Notifications, ${t} new`:'Notifications, nothing new',badge:t,onPress:()=>o('more','notifications')})]})]})}function I(e){if('undefined'==typeof document)return e;const{createPortal:t}=r(d[16]);return t(e,document.body)}},1489,[17,378,219,385,85,19,777,1026,1340,876,804,1490,1190,1485,1057,8,260]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},1490,[831]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffRoles=function(){const e=(0,u.useHourly)(),l=!!(0,u.useSignedIn)(),{role:f,meId:w,rid:x}=(0,u.useCtx)(6e4),j=(0,u.useSignedIn)(),$=(0,c.useOwner)(e=>e.staff),C=(0,c.useOwner)(e=>e.previewRole),[P,z]=(0,t.useState)(''),[_,H]=(0,t.useState)(''),[E,N]=(0,t.useState)('staff'),[Y,F]=(0,t.useState)({}),G=c.CAN.staffAdmin(f),[U,W]=(0,t.useState)(null),[J,K]=(0,t.useState)(''),[V,Z]=(0,t.useState)({});return(0,T.jsxs)(r.default,{style:{gap:10},children:[!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: switch on Manager access to give someone the Managers app (rota, bookings, staff, settings). Switch it off and they use the Front of House app; the Head Chef goes back to the Head Chef app. Job titles don\u2019t change."})}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(r.default,{testID:"cashup-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cCan use cash up\u201d lets a team member open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet. It\u2019s off for staff until you switch it on; owners and managers always have it. People with it show a Cash up tag."})}),j&&'owner'===j.role?(0,T.jsx)(r.default,{testID:"temp-access-tip",children:(0,T.jsx)(i.Muted,{children:"Tip: \u201cTemporary manager access\u201d gives someone the Managers app while their role stays the same. Switch it off later and nothing else changes. Their cash up switch is separate, so set that on its own."})}):null,(0,T.jsx)(O,{ask:U,onClose:()=>W(null)}),(0,T.jsx)(B,{}),(0,T.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Preview as another role"}),(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:['owner','manager','staff'].filter(e=>!j||(0,u.clampRole)(e,j.role)===e).map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:C===e,onPress:()=>c.useOwner.getState().setPreviewRole(e)},e))}),(0,T.jsx)(i.Muted,{children:A[C]})]}),'owner'===f||'manager'===f?(0,T.jsx)(v.AddTempStaffButton,{}):null,(0,T.jsx)(s.TextInput,{testID:"staff-search",accessibilityLabel:"Search the team",value:J,onChangeText:K,placeholder:"Search by name, nickname or job",placeholderTextColor:h.colours.muted,style:{minHeight:42,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15}}),$.filter(e=>(0,c.staffMatches)(e,J)).map(t=>(0,T.jsxs)(i.Card,{style:{opacity:t.active?1:.5},children:[(0,T.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(i.Row,{gap:10,style:{flex:1},children:[!j||'owner'!==f&&'manager'!==f?(0,T.jsx)(p.StaffAvatar,{id:t.id,size:44}):(0,T.jsx)(n.StaffLinkChip,{m:t,actorRole:j.role,size:36}),(0,T.jsx)(i.T,{weight:"semibold",style:{flex:1},children:(0,c.staffLabel)(t)})]}),(0,T.jsx)(i.Badge,{kind:'owner'===t.role?'gold':'manager'===t.role?'blue':'neutral',label:t.level??c.ROLE_LABEL[t.role]})]}),(0,T.jsx)(I,{id:t.id}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(i.Row,{gap:6,children:(0,T.jsx)(S.CashUpAccessBadge,{m:t})}),(0,T.jsxs)(i.Muted,{children:[t.job,t.dept?` \xb7 ${t.dept}`:'',t.active?'':' \xb7 deactivated']}),'staff'!==f&&l?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:`pay-toggle-${t.id}`,label:Y[t.id]?'Hide pay \u25b4':'Pay details \u25be',onPress:()=>F(e=>({...e,[t.id]:!e[t.id]}))}),Y[t.id]?(0,T.jsxs)(i.Muted,{children:[(0,c.wageLabel)(t,e[t.id],o.gbp),t.noTax?' \xb7 No tax deducted':'']}):null]}):null,!j||'owner'!==f&&'manager'!==f||t.managerAccess||t.ownerAccess?null:(0,T.jsx)(R,{person:t,actor:j,onAsk:W}),!j||'owner'!==j.role||j.ownerAccess||'owner'===t.role&&!t.ownerAccess?null:(0,T.jsx)(L,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f||'owner'===t.role||!t.managerAccess&&'staff'!==t.role?null:(0,T.jsx)(D,{person:t,actor:j}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(b.InviteLinkControls,{m:t,actorRole:j.role}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsxs)(i.Row,{gap:6,children:[(0,T.jsx)(i.Muted,{size:12,children:"Nickname"}),(0,T.jsx)(s.TextInput,{testID:`nickname-${t.id}`,accessibilityLabel:`Nickname for ${t.name}`,value:V[t.id]??t.nickname??'',placeholder:"Optional",placeholderTextColor:h.colours.muted,onChangeText:e=>Z(s=>({...s,[t.id]:e})),onBlur:()=>{const e=(V[t.id]??t.nickname??'').trim().slice(0,40);e!==(t.nickname??'')&&c.useOwner.getState().updateStaff(t.id,{nickname:e||void 0})},style:{flex:1,minHeight:34,borderRadius:8,borderWidth:1,borderColor:h.colours.hairline,color:h.colours.text,paddingHorizontal:8}})]}),!j||'owner'!==f&&'manager'!==f?null:(0,T.jsx)(M,{person:t}),!j||'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(S.CashUpAccessToggle,{m:t}),'owner'!==f&&'manager'!==f||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(v.StaffDisplayControls,{m:t}),!j||'owner'!==j.role&&'manager'!==j.role||!t.active||t.name.includes('(example)')?null:(0,T.jsx)(k.AutoClockToggle,{m:t}),j&&('owner'===f||'manager'===f)&&t.active?(0,T.jsx)(y.DailyTasksEditor,{rid:x,person:t,actor:j}):null,G&&t.id!==w&&'owner'!==t.role?(0,T.jsx)(i.Row,{wrap:!0,gap:6,children:(0,T.jsx)(i.Chip,{label:t.active?'Deactivate':'Reactivate',onPress:()=>c.useOwner.getState().updateStaff(t.id,{active:!t.active})})}):null]},t.id)),G?(0,T.jsxs)(i.Card,{children:[(0,T.jsx)(i.T,{weight:"semibold",children:"Add a team member"}),(0,T.jsx)(i.Field,{label:"Name",value:P,onChangeText:z}),(0,T.jsx)(i.Field,{label:"Job title",value:_,onChangeText:H,placeholder:"e.g. Kitchen porter"}),(0,T.jsx)(i.Row,{gap:6,children:['manager','staff'].map(e=>(0,T.jsx)(i.Chip,{label:c.ROLE_LABEL[e],selected:E===e,onPress:()=>N(e)},e))}),(0,T.jsx)(i.Button,{label:"Add (no invite is sent)",disabled:P.trim().length<2,onPress:()=>{c.useOwner.getState().addStaff(P.trim(),E,_.trim()||'Team member'),z(''),H('')}})]}):(0,T.jsx)(i.Banner,{kind:"info",title:"Owner only",children:"Only the owner can add staff or change roles."})]})};var e,s=_r(d[0]),n=_r(d[1]),t=_r(d[2]),o=_r(d[3]),l=_r(d[4]),r=(e=l)&&e.__esModule?e:{default:e},i=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),f=_r(d[10]),w=_r(d[11]),x=_r(d[12]),j=_r(d[13]),y=_r(d[14]),b=_r(d[15]),v=_r(d[16]),k=_r(d[17]),S=_r(d[18]),$=_r(d[19]),C=_r(d[20]),T=_r(d[21]);const A={owner:'Everything, including staff & roles and plan & billing.',manager:'Run service, edit the app, rotas and timesheets. No billing or role changes.',staff:'Orders, bookings, waitlist, allergy alerts, own shifts and clock in/out. No takings, forecasts or settings.'};function I({id:e}){const{role:s,meId:n,me:t}=(0,u.useCtx)(6e4),o=(0,f.useAvatars)(s=>s.photos[e]);return o&&'staff'!==s?(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsxs)(i.Muted,{style:{flex:1},children:["Avatar made from their photo on ",new Date(o.at).toLocaleDateString('en-GB'),"."]}),(0,T.jsx)(i.Button,{small:!0,kind:"secondary",label:"Reset avatar",testID:`reset-avatar-${e}`,onPress:()=>f.useAvatars.getState().reset(e,{id:n,role:s,name:t.replace(' (example)','')})})]}):null}function M({person:e}){const s=(0,$.canChangeBookings)(e),n='owner'===e.role||'manager'===e.role||!!e.ownerAccess||!!e.managerAccess,o=e.name.replace(' (example)','').split(' ')[0],[l,u]=(0,t.useState)(null);return(0,T.jsxs)(r.default,{testID:`privileges-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:"Privileges"}),(0,T.jsx)(i.Toggle,{testID:`booking-write-${e.id}`,label:"Can add and change bookings",a11y:`Can add and change bookings for ${o}: ${s?'on':'off'}`,value:s,disabled:n,onChange:s=>{c.useOwner.getState().updateStaff(e.id,{bookingWrite:s}),(0,C.setCanChangeBookings)(e.id,s).then(e=>u(e.ok?s?`${o} can add and change bookings.`:`${o} can only view bookings.`:e.error??'Saved on this device. It will reach the server when you are connected.'))}}),(0,T.jsx)(i.Muted,{size:12,children:n?'Always on for owners and managers.':s?(0,$.isKitchenPorter)(e)?'Switched on for this kitchen porter.':'Can add walk-ins and change bookings.':'View only. They can see bookings, the plan and the Timeline.'}),l?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`booking-write-msg-${e.id}`,children:l})}):null]})}function R({person:e,actor:s,onAsk:n}){const t=(0,w.canToggleAccess)(s,e),o=(0,w.hasManagerAccess)(e);return(0,T.jsxs)(r.default,{testID:`access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`access-toggle-${e.id}`,label:"Manager access",value:o,disabled:!t.ok,onChange:s=>n({id:e.id,on:s})}),(0,T.jsxs)(i.Muted,{size:12,children:['owner'===e.role?'Owner: always full access':o?'Uses the Manager app':'Head Chef'===e.level?'Uses the Head Chef app':'Uses the Front of House app',t.ok||'owner'===e.role?'':` \xb7 ${t.why}`]})]})}function D({person:e,actor:s}){const n=(0,w.canToggleTempAccess)(s,e),o=!!e.managerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary manager access'),[p,f]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),b=e.name.replace(' (example)','').split(' ')[0],v=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempManagerAccess)(e.id,l,h);f(!1),c(null),y(s.ok?l?`${b} now has temporary manager access. Logged with your name, the time and the reason.`:`${b}\u2019s temporary manager access is off. Their role and cash up are unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-access-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-access-toggle-${e.id}`,label:"Temporary manager access",a11y:`Temporary manager access for ${b}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Uses the Managers app. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),j?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-access-msg-${e.id}`,children:j})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${b} temporary manager access?`:`Switch off ${b}\u2019s temporary manager access?`,testID:"temp-access-confirm",children:[(0,T.jsx)(i.T,{children:l?`${b} gets the Managers app. Their role stays ${e.level??'Staff'}.`:`${b} goes back to their own app. Role, cash up, pay and links don\u2019t change.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-access-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{v()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function L({person:e,actor:s}){const n='owner'!==s.role||s.ownerAccess?{ok:!1,why:'Only an owner can change this.'}:{ok:!0},o=!!e.ownerAccess,[l,c]=(0,t.useState)(null),[h,u]=(0,t.useState)('temporary owner access'),[p,f]=(0,t.useState)(!1),[w,j]=(0,t.useState)(null),y=e.name.replace(' (example)','').split(' ')[0],b=async()=>{if(null===l)return;f(!0);const s=await(0,x.setTempOwnerAccess)(e.id,l,h);f(!1),c(null),j(s.ok?l?`${y} now has temporary owner access. Logged with your name, the time and the reason.`:`${y}\u2019s temporary owner access is off. Their own role is unchanged.`:s.message)};return(0,T.jsxs)(r.default,{testID:`temp-owner-row-${e.id}`,style:{gap:2},children:[(0,T.jsx)(i.Toggle,{testID:`temp-owner-toggle-${e.id}`,label:"Temporary owner access",a11y:`Temporary owner access for ${y}: ${o?'on':'off'}`,value:o,disabled:!n.ok||p,onChange:e=>c(e)}),(0,T.jsxs)(i.Muted,{size:12,children:[o?`Owner access. Role stays ${e.level??'Staff'}.`:'Off.',n.ok?'':` \xb7 ${n.why}`]}),w?(0,T.jsx)(r.default,{accessibilityLiveRegion:"polite",children:(0,T.jsx)(i.Muted,{size:12,testID:`temp-owner-msg-${e.id}`,children:w})}):null,null!==l?(0,T.jsxs)(i.Sheet,{visible:!0,onClose:()=>c(null),title:l?`Give ${y} temporary owner access?`:`Switch off ${y}\u2019s temporary owner access?`,testID:"temp-owner-confirm",children:[(0,T.jsx)(i.T,{children:l?`${y} gets owner access in the Managers app. Their role stays ${e.level??'Staff'}.`:`${y} keeps their own role and app. Only the extra owner access is removed.`}),(0,T.jsx)(i.Field,{label:"Reason (kept in the log)",value:h,onChangeText:u}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"temp-owner-yes",label:p?'Saving\u2026':l?'Yes, give access':'Yes, switch off',disabled:p,onPress:()=>{b()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:()=>c(null)})]})]}):null]})}function O({ask:e,onClose:s}){const n=(0,c.useOwner)(e=>e.staff),[o,l]=(0,t.useState)(!1),r=e?n.find(s=>s.id===e.id):void 0;if(!e||!r)return null;const h=(0,w.accessResult)(r,e.on),u=r.name.replace(' (example)','').split(' ')[0],p=async()=>{l(!0);if('staff'===x.useSync.getState().kind&&!!x.useSync.getState().venueId){const n=await(0,x.setManagerAccess)(r.id,e.on);if(l(!1),!n.ok)return(0,j.notify)({id:'access-change',tone:'warn',title:'Not changed',body:n.message,timeoutMs:9e3}),void s()}else c.useOwner.getState().updateStaff(r.id,{role:h.role,level:h.level}),l(!1);(0,j.notify)({id:'access-change',icon:'\ud83d\udd11',kicker:'MANAGER ACCESS',title:e.on?`${u} now has manager access`:`${u}\u2019s manager access is off`,body:`${u} now uses the ${h.app}. Their personal link opens it next time. Logged with your name and the time.`,timeoutMs:8e3}),s()};return(0,T.jsxs)(i.Sheet,{visible:!0,onClose:s,title:e.on?`Give ${u} manager access?`:`Switch off ${u}\u2019s manager access?`,testID:"access-confirm",children:[(0,T.jsx)(i.T,{children:e.on?`${u} will get the Manager app: rota, bookings, staff, hours and settings, plus their own clock in, rota and pay.`:`${u} will use the ${h.app}. They keep their job title (${r.job||'none'}).`}),(0,T.jsx)(i.Muted,{children:"This is logged with your name and the time. You can change it back at any time."}),(0,T.jsxs)(i.Row,{gap:8,children:[(0,T.jsx)(i.Button,{testID:"access-confirm-yes",label:o?'Saving\u2026':e.on?'Yes, give access':'Yes, switch off',disabled:o,onPress:()=>{p()}}),(0,T.jsx)(i.Button,{kind:"ghost",label:"Cancel",onPress:s})]})]})}function B(){const[e,s]=(0,t.useState)(null);return(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId)?(0,T.jsxs)(r.default,{style:{gap:4},children:[(0,T.jsx)(i.Button,{small:!0,kind:"secondary",testID:"access-log-open",label:e?'Hide access changes \u25b4':'Access changes \u25be',onPress:()=>{e?s(null):(0,x.readAccessLog)().then(s)}}),e?e.length?e.map((e,s)=>(0,T.jsxs)(i.Muted,{size:12,children:[new Date(String(e.changed_at)).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",String(e.changed_by_name??'')," switched ",e.access_on?'on':'off'," ",'manager_access_flag'===e.kind?'temporary ':'',"manager access for ",String(e.staff_name??''),e.reason?` (${String(e.reason)})`:'']},s)):(0,T.jsx)(i.Muted,{size:12,children:"No changes yet."}):null]}):null}},1491,[812,1455,17,851,85,777,876,804,1057,884,885,1492,899,916,1031,1453,1493,1494,1496,996,1497,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.canToggleAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'staff'===n.role?{ok:!1,why:'Only owners and managers can change this.'}:'manager'===n.role&&n.id===o.id?{ok:!1,why:'You can\u2019t change your own access. Ask an owner.'}:{ok:!0}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"hasManagerAccess",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isHeadChef",{enumerable:!0,get:function(){return o}}),e.accessResult=function(n,t,c){return t?{role:'manager',level:'Manager',app:'Manager app'}:o(n,c)?{role:'staff',level:'Head Chef',app:'Head Chef app'}:{role:'staff',level:'Staff',app:'Front of House app'}},e.canToggleTempAccess=function(n,o){return n?'owner'===o.role?{ok:!1,why:'Owners always have full access.'}:'owner'!==n.role?{ok:!1,why:'Only an owner can change this.'}:'manager'!==o.role||o.managerAccess?{ok:!0}:{ok:!1,why:'Already a manager.'}:{ok:!1,why:'Sign in from your link first.'}},Object.defineProperty(e,"effectiveRole",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"roleWithoutTempAccess",{enumerable:!0,get:function(){return c}});const n=n=>'manager'===n.role||'owner'===n.role,o=(n,o)=>'head_chef'===o||'Head Chef'===(n.level??'')||/^head chef/i.test(n.job??'');const t=(n,o)=>'owner'===n?'owner':o?'manager':n,c=n=>n.managerAccess?'staff':n.role},1492,[]); +__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])},1493,[812,17,85,777,804,876,1356,1355,8]); +__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])},1494,[17,85,777,1495,804,8]); +__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},1495,[831,928,899,880]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1496,[17,85,777,804,914,1022,899,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.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])},1497,[928,899]); +__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 h}}),Object.defineProperty(_e,"PLAN_SUB",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"PLAN_FEATURE_NOTE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PLAN_SUPPORT_LINE",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"PLAN_GUEST_APP_LINE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"PLAN_GUEST_APP_DETAIL",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"PLAN_OTA_LINE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"PLAN_OTA_TERM",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"PLAN_DESKTOP_LINE",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"PLAN_DESKTOP_DETAIL",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"PLAN_DESKTOP_SUPERPRO_LINE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LINE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_LITE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"PLAN_AI_ASSISTANT_TERM",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"PLAN_PRICE_NOTE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_NAME",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_NAME",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"PLAN_SUPERPRO_NAME",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_PRICE",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_PRICE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"PLAN_SUPERPRO_PRICE",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"PLAN_USUAL_LITE_BLURB",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"PLAN_USUAL_PRO_BLURB",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"PLAN_SUPERPRO_BLURB",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"PLAN_SUPERPRO_EPOS_LINE",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"PLAN_EARLY_TERM",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"PLAN_TERMS_LINE",{enumerable:!0,get:function(){return $}}),_e.PlanBilling=function(){const{now:e,role:n}=(0,c.useCtx)(6e4),h=(0,u.trialStatus)((0,l.defaultSimStart)(),e),[y,f]=(0,t.useState)(!1);return i.CAN.billing(n)?y?(0,p.jsx)(q,{onBack:()=>f(!1)}):(0,p.jsxs)(o.default,{style:{gap:10},children:[(0,p.jsx)(s.Banner,{kind:"demo",title:"Billing: not set up yet",children:"No card is taken and nothing is charged."}),(0,p.jsxs)(s.Card,{highlight:d.colours.gold,children:[(0,p.jsxs)(o.default,{testID:"plan-founding",style:{alignItems:'center',gap:2},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:"EARLY ADOPTER OFFER \xb7 FIRST 50"}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:"Every Pro feature at the early-adopter price."}),(0,p.jsxs)(s.T,{size:30,style:{textAlign:'center'},weight:"bold",children:["\xa349",(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[S,". Usual Full Restaurant Pro App price \xa399 a month."]}),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-early-term",children:D})]}),(0,p.jsx)(o.default,{testID:"plan-early-list",style:{gap:4,marginTop:6,alignItems:'center'},children:Y.map(([e,t])=>(0,p.jsxs)(o.default,{testID:e===b?'plan-early-guest-app':e===x?'plan-early-desktop':'Free customer support'===e?'plan-early-support':void 0,style:{alignItems:'center'},children:[(0,p.jsxs)(s.T,{size:13,weight:"semibold",style:{textAlign:'center'},children:["\u2713 ",e]}),(0,p.jsx)(s.Muted,{center:!0,size:12,children:t})]},e))})]}),(0,p.jsx)(s.Muted,{center:!0,children:"Usual prices"}),[['plan-usual-lite',L,N,M,z,'Usual price',''],['plan-usual-pro',E,R,U,G,'Usual price',''],['plan-superpro',k,C,F,V,'1-year contract','No hardware included.']].map(([e,t,n,l,i,u,c])=>(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:e,style:{gap:2,alignItems:'center'},children:[(0,p.jsx)(s.T,{size:12,weight:"semibold",colour:d.colours.goldMuted,style:{textAlign:'center'},children:u.toUpperCase()}),(0,p.jsx)(s.T,{weight:"semibold",style:{textAlign:'center'},children:t}),(0,p.jsxs)(s.T,{size:26,weight:"bold",style:{textAlign:'center'},children:[n,(0,p.jsx)(s.T,{size:14,colour:d.colours.muted,children:" / month"})]}),(0,p.jsx)(s.Muted,{center:!0,children:S}),(0,p.jsx)(s.Muted,{center:!0,children:l}),'plan-superpro'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-superpro-epos-line",children:B}):null,i.map(e=>(0,p.jsxs)(s.T,{size:13,style:{textAlign:'center'},children:["\u2713 ",e]},e)),'plan-usual-lite'===e?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-lite-ai",children:I}):null,c?(0,p.jsx)(s.Muted,{center:!0,children:c}):null]})},e)),(0,p.jsx)(s.Muted,{center:!0,testID:"plan-terms",children:$}),(0,p.jsx)(s.Button,{small:!0,kind:"secondary",label:"Set-up guide",testID:"setup-guide-open",onPress:()=>f(!0),style:{alignSelf:'center'}}),(0,p.jsx)(s.Card,{children:(0,p.jsxs)(o.default,{testID:"plan-store-listing",style:{gap:4},children:[(0,p.jsxs)(s.T,{weight:"semibold",children:["Your venue in the CoverCharge app on the Apple App Store and Google Play: ",(0,p.jsx)(s.T,{weight:"bold",colour:d.colours.gold,children:"free"}),"."]}),(0,p.jsx)(s.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,p.jsx)(s.Muted,{center:!0,children:"Setup is all done digitally with the in-app guided setup and step-by-step guides, with free customer support for the length of your subscription. Edit your basic info yourself anytime (prices, sold-out, hours, specials)."}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(s.T,{children:"Free trial"}),(0,p.jsxs)(s.T,{weight:"bold",colour:d.colours.gold,children:[h.daysLeft," day",1===h.daysLeft?'':'s'," left"]})]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(100*(1-h.daysLeft/h.total))}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),(0,p.jsxs)(s.Muted,{center:!0,children:["Then \xa3",u.PLAN.monthlyPence/100," a month + VAT if applicable, per venue. Nothing starts automatically after your free month. The trial start date is not set up yet."]})]}),(0,p.jsxs)(s.Card,{children:[(0,p.jsxs)(s.Row,{style:{justifyContent:'center'},gap:8,children:[(0,p.jsx)(s.T,{weight:"semibold",children:"Free customer support"}),(0,p.jsx)(s.Badge,{kind:"gold",label:"Included"})]}),(0,p.jsxs)(s.Muted,{center:!0,children:[P,", on every plan. Setup is all done digitally. Support contact details: not set up yet."]})]})]}):(0,p.jsx)(s.Banner,{kind:"info",title:"Owner only",children:"Plan & billing is visible to the owner only."})};var e,t=r(_d[0]),n=r(_d[1]),o=(e=n)&&e.__esModule?e:{default:e},s=r(_d[2]),l=r(_d[3]),i=r(_d[4]),u=r(_d[5]),d=r(_d[6]),c=r(_d[7]),p=r(_d[8]);const h=!0,y='Early adopter offer, usual prices, free trial, set-up guide',f='. The owner dashboard and admin, and the owner desktop version (the complete ecosystem on Mac or PC), come with Full Restaurant Pro App (\xa399 a month), SuperPro (\xa3149 a month) and the early adopter offer (\xa349 a month), + VAT if applicable, per venue. They are not included with Customer & Takeaway App',P='Free customer support for the length of your subscription',b='Downloadable customer app for guests\u2019 phones',A='Guests download your customer app on their own phones. Comes with every plan.',j='Free over-the-air updates',w='Over-the-air updates will be available free of charge to the app.',x='Owner desktop version: the complete ecosystem on Mac or PC',T='The same data, sign-ins and permissions, installable on a Mac or Windows PC.',_='Owner desktop version: the complete ecosystem on Mac or PC, with full ecosystem insights once your EPOS is connected',v='AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',I='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer.',O='AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App.',S='+ VAT if applicable, per venue',L='Customer & Takeaway App',E='Full Restaurant Pro App',k='SuperPro',N='\xa349',R='\xa399',C='\xa3149',M='The lite version: core features for smaller venues.',U='Every feature, every app.',F='Everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract.',B='Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in.',D='One-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice.',Y=[['All Pro features','Every feature, every app.'],['12-month contract at \xa349',D],['One month free','Try everything before you pay anything.'],['Your brand','Your logo and colour in the \u201cYour venue\u201d app.'],[b,A],['Free customer support','For the length of your subscription.'],[x,T],[v,v],[j,w]],z=['\u201cYour venue\u201d app, powered by CoverCharge','Collection ordering','Loyalty stamp card','Menu and allergens','Allergy checks on every basket','Private feedback',b,P,j],G=['Owner dashboard and admin','Supplier links',x,v,b,P,j],V=['Everything in Full Restaurant Pro','A full venue app, staff and customer sides','The CoverCharge EPOS: tills, kitchen displays and waiter pads','Installed at your venue by us, EPOS checked',_,v,b,P,j],$='All prices + VAT if applicable, per venue. Early adopter offer: one-month free trial, then a 12-month contract at \xa349 a month, then rolling monthly at \xa399 with one month\u2019s notice. Customer & Takeaway App and Full Restaurant Pro App: one-month free trial, then rolling monthly. SuperPro: 12 months, then rolling monthly, no free trial. Free customer support for the length of your subscription, on every plan. The downloadable customer app for guests\u2019 phones comes with every plan. Over-the-air updates will be available free of charge to the app. The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant connection comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. It can answer questions about your venue, give advice, draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged.',K=[['Choose what to switch on','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 q({onBack:e}){const[n,l]=(0,t.useState)([]);return(0,p.jsxs)(o.default,{style:{gap:10},testID:"setup-guide",children:[(0,p.jsx)(s.Button,{small:!0,kind:"ghost",label:"\u2039 Plan & billing",onPress:e}),(0,p.jsx)(s.H2,{children:"Set-up guide"}),(0,p.jsxs)(s.Muted,{children:["Setup is all done digitally, one step at a time: this guide plus Managers \u203a Settings \u203a Guided setup. ",n.length," of ",K.length," done."]}),(0,p.jsx)(o.default,{style:{height:8,backgroundColor:d.colours.border,borderRadius:4},children:(0,p.jsx)(o.default,{style:{height:8,width:`${Math.round(n.length/K.length*100)}%`,backgroundColor:d.colours.gold,borderRadius:4}})}),K.map(([e,t],i)=>{const u=n.includes(i);return(0,p.jsx)(s.Card,{children:(0,p.jsxs)(s.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(o.default,{style:{width:28,height:28,borderRadius:14,borderWidth:1.5,borderColor:d.colours.gold,backgroundColor:u?d.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(s.T,{size:14,weight:"bold",colour:u?'#1a1610':d.colours.gold,children:u?'\u2713':String(i+1)})}),(0,p.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(s.T,{weight:"semibold",children:e}),(0,p.jsx)(s.Muted,{children:t}),(0,p.jsx)(s.Button,{small:!0,kind:u?'ghost':'secondary',label:u?'Mark as not done':'Mark as done',accessibilityLabel:`${u?'Undo':'Done'}: ${e}`,onPress:()=>l(u?n.filter(e=>e!==i):[...n,i])})]})]})},e)}),(0,p.jsx)(s.Muted,{children:"Stuck? Free customer support is included for the length of your subscription. Ticks on this guide are not saved."})]})}},1498,[17,85,777,835,876,1499,804,1057,8]); +__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'}},1499,[]); +__d(function(_g,_r,_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,C.useCtx)(6e4),[t,s]=(0,c.useState)(e.tagline),[n,l]=(0,c.useState)(e.phone??''),[i,r]=(0,c.useState)(e.about??''),[d,o]=(0,c.useState)(e.kitchenHours),[u,g]=(0,c.useState)(!1);return(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.name}),(0,P.jsx)(x.Muted,{children:e.location}),(0,P.jsx)(x.Field,{label:"Tagline",value:t,onChangeText:s}),(0,P.jsx)(x.Field,{label:"Phone",value:n,onChangeText:l,keyboardType:"phone-pad"}),(0,P.jsx)(x.Field,{label:"About",value:i,onChangeText:r,multiline:!0,placeholder:"A short welcome for the app's restaurant page"})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Kitchen hours"}),R.map((e,t)=>{const s=B[t],n=d[s];return(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{style:{width:44},children:e}),n?(0,P.jsxs)(x.Row,{gap:4,style:{flex:1,minWidth:0},children:[(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} opens`,value:n[0],onChangeText:e=>o({...d,[s]:[e,n[1]]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]}),(0,P.jsx)(x.T,{children:"\u2013"}),(0,P.jsx)(a.TextInput,{accessibilityLabel:`${e} closes`,value:n[1],onChangeText:e=>o({...d,[s]:[n[0],e]}),style:[x.styles.input,{flex:1,minWidth:0,paddingVertical:6}]})]}):(0,P.jsx)(x.Muted,{style:{flex:1},children:"Closed"}),(0,P.jsx)(h.default,{accessibilityLabel:`${e} open`,value:!!n,onValueChange:e=>o({...d,[s]:e?['12:00','20:00']:null}),trackColor:{true:w.colours.gold,false:'#444'},thumbColor:n?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:w.colours.gold,style:{marginLeft:8}})]},e)}),e.hoursNote?(0,P.jsx)(x.Muted,{children:e.hoursNote}):null]}),(0,P.jsx)(x.Button,{label:"Save changes",onPress:()=>{M().updateRestaurant(e.id,{tagline:t,phone:n,about:i,kitchenHours:d}),g(!0)}}),u?(0,P.jsx)(x.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,m.useOwner)(e=>e.photos),[t,s]=(0,c.useState)('');return r.LIVE_VENUE_BUILD?(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Photo uploads are not connected"}),(0,P.jsx)(x.Muted,{children:"No photo uploads are available here. Your existing venue artwork is unchanged."})]}):(0,P.jsxs)(p.default,{style:{gap:12},children:[(0,P.jsx)(x.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,P.jsx)(x.Row,{wrap:!0,gap:8,children:e.map(e=>(0,P.jsxs)(p.default,{style:{width:'48%',height:120,backgroundColor:e.tone,borderRadius:12,padding:8,justifyContent:'flex-end'},children:[(0,P.jsx)(x.T,{size:13,children:e.caption}),(0,P.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`Remove photo ${e.caption}`,onPress:()=>m.useOwner.getState().removePhoto(e.id),style:{minHeight:44,minWidth:44,justifyContent:'center',alignSelf:'flex-start'},children:(0,P.jsx)(x.T,{size:13,colour:w.colours.gold,children:"Remove"})})]},e.id))}),(0,P.jsx)(x.Field,{label:"Caption",value:t,onChangeText:s,placeholder:"e.g. Langoustines on the terrace"}),(0,P.jsx)(x.Button,{label:"Add photo (placeholder)",disabled:!t.trim(),onPress:()=>{m.useOwner.getState().addPhoto(`${t.trim()} (placeholder)`),s('')}})]})},_e.MenuManager=function({go:e}={}){const{rid:t,r:s,me:l,role:i}=(0,C.useCtx)(6e4),a=(0,f.useAllMenu)(t),[d,o]=(0,c.useState)(null),[h,g]=(0,c.useState)(!1),[m,j]=(0,c.useState)(5),[y,T]=(0,c.useState)([]),[k,R]=(0,c.useState)('all'),B=(0,f.useStore)(e=>e.menu),$=e=>!!B.find(t=>t.id===e)?.hidden,A=a.filter(e=>!e.signOff&&!$(e.id)).length;return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Button,{small:!0,label:"Add dish",onPress:()=>o('new')}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:h?'Done':'Bulk price edit',onPress:()=>{g(!h),T([])}}),!e||'owner'!==i&&'manager'!==i?null:(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"New dish creator \u203a",accessibilityLabel:"Open New dish creator",onPress:()=>e('more','dishcreator')})]}),A?(0,P.jsx)(u.default,{accessibilityRole:"button",onPress:()=>e?.('more','recipecards'),children:(0,P.jsx)(x.Banner,{kind:"warn",title:`${A} dish${1===A?'':'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,P.jsx)(x.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,r.LIVE_VENUE_BUILD?(0,P.jsx)(x.Muted,{children:"The saved menu is shown without an automatic lunch or dinner schedule."}):(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Scheduled menus"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:"All day",selected:'all'===k,onPress:()=>R('all')}),(0,P.jsx)(x.Chip,{label:"Lunch 12:00\u201316:30",selected:'lunch'===k,onPress:()=>R('lunch')}),(0,P.jsx)(x.Chip,{label:"Dinner 16:30\u2013close",selected:'dinner'===k,onPress:()=>R('dinner')})]}),(0,P.jsx)(x.Muted,{children:'all'===k?'The full menu shows all day.':`Preview: the ${k} menu switches automatically at the times above (example schedule).`})]}),h?(0,P.jsxs)(x.Card,{highlight:w.colours.gold,children:[(0,P.jsxs)(x.T,{weight:"semibold",children:["Bulk price edit \xb7 ",y.length," selected"]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Change by %"}),(0,P.jsx)(x.Stepper,{value:m,onChange:j,min:-30,max:30,label:"percent"})]}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Select all priced",onPress:()=>T(a.filter(e=>null!=e.price).map(e=>e.id))}),(0,P.jsx)(x.Button,{small:!0,label:`Apply ${m>0?'+':''}${m}%`,disabled:!y.length||0===m,onPress:()=>{y.forEach(e=>{const t=a.find(t=>t.id===e);null!=t?.price&&M().updateMenuItem(e,{price:5*Math.round(t.price*(100+m)/100/5)})}),T([])}})]}),(0,P.jsx)(x.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,P.jsxs)(p.default,{style:{gap:6},children:[(0,P.jsx)(S.SectionHead,{title:e}),t.map(e=>(0,P.jsxs)(p.default,{style:[x.styles.card,{opacity:e.hidden?.5:1,padding:10}],children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[h&&null!=e.price?(0,P.jsx)(x.Toggle,{label:`select ${e.name}`,value:y.includes(e.id),onChange:t=>T(t?[...y,e.id]:y.filter(t=>t!==e.id))}):null,(0,P.jsxs)(u.default,{style:{flex:1},onPress:()=>o(e),accessibilityRole:"button",children:[(0,P.jsx)(x.T,{weight:"medium",children:e.name}),(0,P.jsxs)(x.Muted,{children:[null!=e.price?(0,b.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,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(x.Chip,{label:e.soldOut?'Sold out (tap: Back on)':'Mark sold out',selected:e.soldOut,onPress:()=>((0,n.setSoldOut)(e.id,!e.soldOut),(0,v.autoPost)(['kitchen','foh'],e.soldOut?`Back on: ${e.name}`:`Sold out: ${e.name}`))}),(0,P.jsx)(x.Chip,{label:$(e.id)?'Hidden':e.hidden?'Off until signed off':'Visible',selected:$(e.id),onPress:()=>M().updateMenuItem(e.id,{hidden:!$(e.id)})})]})]},e.id))]},e):null}),d?(0,P.jsx)(O,{item:'new'===d?null:d,onClose:()=>o(null),go:e}):null]})},_e.EventsPage=function({go:e}){const{rid:t,today:n}=(0,C.useCtx)(6e4),l=(0,f.useEvents)(t).filter(e=>e.restaurantId===t),[i,a]=(0,c.useState)(''),[r,d]=(0,c.useState)(''),[o,u]=(0,c.useState)(''),[h,g]=(0,c.useState)(null),m=(()=>{const e=r.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=i.trim().length>2&&!!m&&!Number.isNaN((0,y.parseYmd)(m).getTime());return(0,P.jsxs)(p.default,{style:{gap:10},children:[l.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:t.date=n?(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.eventDraft)(t)),style:{alignSelf:'flex-start'}}):null,t.example?null:h===t.id?(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, remove",testID:"event-remove-yes",onPress:()=>{f.useStore.setState(e=>({events:e.events.filter(e=>e.id!==t.id)})),g(null)}}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>g(null)})]}):(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${t.title}`,onPress:()=>g(t.id),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Add an event"}),(0,P.jsx)(x.Field,{label:"Title",value:i,onChangeText:a,placeholder:"e.g. Seafood night"}),(0,P.jsx)(x.Field,{label:"Date (DD/MM/YYYY)",value:r,onChangeText:e=>d((0,s.slashDate)(e,r)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10}),(0,P.jsx)(x.Field,{label:"Description",value:o,onChangeText:u,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add event",disabled:!j,onPress:()=>{M().addEvent({restaurantId:t,date:m,title:i.trim(),kind:'event',description:o.trim(),example:!1}),a(''),d(''),u('')}}),(0,P.jsx)(x.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,C.useCtx)(6e4),s=(0,f.useStore)((0,g.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[n,i]=(0,c.useState)(25),[a,r]=(0,c.useState)(''),d=s.reduce((e,t)=>e+t.initial,0),o=s.reduce((e,t)=>e+t.balance,0);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{gap:8,children:[(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Sold (all time)"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(d)})]}),(0,P.jsxs)(x.Card,{style:{flex:1},children:[(0,P.jsx)(x.Muted,{children:"Outstanding balance"}),(0,P.jsx)(x.T,{size:20,weight:"bold",children:(0,b.gbp)(o)})]})]}),s.map(e=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.recipientName}),e.legacy?(0,P.jsx)(x.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,P.jsxs)(x.Muted,{children:[e.code," \xb7 ",(0,b.gbp)(e.balance)," of ",(0,b.gbp)(e.initial)," \xb7 ",e.createdAt]})]},e.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Issue a gift card at the till"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,P.jsx)(x.Chip,{label:`\xa3${e}`,selected:n===e,onPress:()=>i(e)},e))}),(0,P.jsx)(x.Field,{label:"Recipient",value:a,onChangeText:r}),t.IS_GREENSIDE?(0,P.jsx)(l.GreensideCashOnly,{}):(0,P.jsx)(x.Banner,{kind:"info",title:"Card payments: not set up yet",children:"Take payment on your till as usual; nothing is charged here."}),(0,P.jsx)(x.Button,{label:`Issue \xa3${n} card`,disabled:a.trim().length<2,onPress:()=>{M().buyGiftCard(e,100*n,a.trim(),'Issued at the till'),r('')}})]})]})},_e.Feedback=function(){const{rid:e}=(0,C.useCtx)(6e4),t=(0,f.useRatings)(e),[s,n]=(0,c.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,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:t.length?`${i.toFixed(1)}\u2605 average \xb7 ${t.length} ratings`:'No ratings recorded yet'}),(0,P.jsxs)(x.Row,{gap:4,children:[(0,P.jsx)(x.Chip,{label:"All",selected:'all'===s,onPress:()=>n('all')}),(0,P.jsx)(x.Chip,{label:"3\u2605 or less",selected:'low'===s,onPress:()=>n('low')})]})]}),t.some(e=>e.stars<=2)?(0,P.jsx)(x.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,P.jsxs)(x.Card,{highlight:e.stars<=2?w.colours.red:void 0,children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",children:e.customerName}),(0,P.jsxs)(x.T,{colour:w.colours.gold,children:['\u2605'.repeat(e.stars),'\u2606'.repeat(5-e.stars)]})]}),(0,P.jsx)(x.T,{size:14,children:e.comment||'(no comment)'}),(0,P.jsx)(x.Muted,{children:e.context??''})]},e.id)),(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:"Private feedback from the app after each visit. Reply drafts are under Reviews."})]})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return S.DemoTag}}),_e.StampSettings=function(){return r.LIVE_VENUE_BUILD||(0,d.staffServer)()?(0,P.jsx)(o.LoyaltySettingsPanel,{}):(0,P.jsx)(A,{})},_e.Offers=function({go:e}){return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,d.staffServer)()?(0,P.jsx)(x.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,P.jsx)($,{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=_r(_d[8]),c=_r(_d[9]),u=e(_r(_d[10])),h=e(_r(_d[11])),p=e(_r(_d[12])),g=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),m=_r(_d[16]),j=_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]),k=_r(_d[25]),P=_r(_d[26]);const R=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],B=[1,2,3,4,5,6,0],M=()=>f.useStore.getState();function O({item:e,onClose:t,go:s}){const{rid:n,r:l}=(0,C.useCtx)(6e4),[i,a]=(0,c.useState)(e?.name??''),[r,d]=(0,c.useState)(e?.description??''),[o,u]=(0,c.useState)(null!=e?.price?(e.price/100).toFixed(2):''),[h,p]=(0,c.useState)(e?.section??l.sections[0]??'Mains'),[g,f]=(0,c.useState)(e?.prepMins??0),m=''===o.trim()?null:Math.round(100*Number(o)),b=i.trim().length>1&&(null==m||Number.isFinite(m)&&m>=0),y=e?.allergens??{},w=!!e&&(i.trim()!==e.name||m!==e.price||h!==e.section);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:t,title:e?`Edit ${e.name}`:'Add a dish',children:[(0,P.jsx)(x.Field,{label:"Name",value:i,onChangeText:a}),(0,P.jsx)(x.Field,{label:"Description",value:r,onChangeText:d,multiline:!0}),(0,P.jsx)(x.Field,{money:!0,label:"Price \xa3 (blank = board price)",value:o,onChangeText:u,keyboardType:"decimal-pad"}),(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:l.sections.map(e=>(0,P.jsx)(x.Chip,{label:e,selected:h===e,onPress:()=>p(e)},e))}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Prep time (min)"}),(0,P.jsx)(x.Stepper,{value:g,onChange:f,min:1,max:60,label:"prep minutes"})]}),(0,P.jsx)(x.T,{weight:"semibold",children:"14 allergens (from the recipe card)"}),(0,P.jsxs)(x.Row,{wrap:!0,gap:6,children:[j.ALLERGENS.filter(e=>y[e.id]).map(e=>(0,P.jsx)(x.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,P.jsx)(x.Muted,{children:e.signOff?'None of the 14 declared.':'Allergens not confirmed.'}):null]}),(0,P.jsx)(x.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,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Edit allergens, ingredients and photo on the recipe card \u203a",onPress:()=>{t(),s('more','recipecards')}}):null,w&&e?.signOff?(0,P.jsx)(x.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,P.jsx)(x.Button,{label:e?'Save dish':'Add dish',disabled:!b,onPress:()=>{e?M().updateMenuItem(e.id,{name:i.trim(),description:r.trim(),price:m,section:h,prepMins:g}):M().addMenuItem({restaurantId:n,section:h,name:i.trim(),description:r.trim(),price:m,dietary:[],allergens:{},prepMins:g,soldOut:!1,signOff:null}),t()}})]})}function $({go:e}){const{now:t}=(0,C.useCtx)(6e4),s=(0,m.useOwner)(e=>e.offers),[n,l]=(0,c.useState)(''),[a,r]=(0,c.useState)(''),[d,o]=(0,c.useState)('special'),[u,h]=(0,c.useState)(null);return(0,P.jsxs)(p.default,{style:{gap:10},children:[s.map(t=>(0,P.jsxs)(x.Card,{children:[(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{weight:"semibold",style:{flex:1},children:t.title}),(0,P.jsx)(x.Badge,{kind:'special'===t.kind?'gold':'blue',label:'special'===t.kind?'Special':'Offer'})]}),(0,P.jsxs)(x.Muted,{children:[t.body,t.until?` \xb7 until ${(0,y.niceDate)((0,y.parseYmd)(t.until))}`:'']}),t.pushedAt?(0,P.jsx)(x.Badge,{kind:"amber",label:`Previewed ${t.pushedAt} (push is off: nothing is sent)`}):null,(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Toggle,{label:"Live in app",value:t.live,onChange:e=>m.useOwner.getState().updateOffer(t.id,{live:e})}),(0,P.jsx)(x.Muted,{children:t.live?'Live in app':'Hidden'}),(0,P.jsx)(p.default,{style:{flex:1}}),(0,P.jsx)(x.Button,{small:!0,kind:"secondary",label:"Push to customers",onPress:()=>h(t.id)})]}),(0,P.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,T.shareToSocial)(e,(0,T.specialDraft)(t)),style:{alignSelf:'flex-start'}})]},t.id)),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"New special or offer"}),(0,P.jsxs)(x.Row,{gap:6,children:[(0,P.jsx)(x.Chip,{label:"Special",selected:'special'===d,onPress:()=>o('special')}),(0,P.jsx)(x.Chip,{label:"Offer",selected:'offer'===d,onPress:()=>o('offer')})]}),(0,P.jsx)(x.Field,{label:"Title",value:n,onChangeText:l}),(0,P.jsx)(x.Field,{label:"Details",value:a,onChangeText:r,multiline:!0}),(0,P.jsx)(x.Button,{label:"Add",disabled:n.trim().length<3,onPress:()=>{m.useOwner.getState().addOffer({title:n.trim(),body:a.trim(),kind:d,live:!0}),l(''),r('')}})]}),u?(()=>{const e=s.find(e=>e.id===u);return(0,P.jsxs)(x.Sheet,{visible:!0,onClose:()=>h(null),title:"Push notification composer",children:[(0,P.jsx)(x.Banner,{kind:"demo",title:"Delivery is not connected",children:"This previews the push. No notification goes to anyone."}),(0,P.jsxs)(p.default,{style:{backgroundColor:(0,i.soutersSurface)('#1F1F1F'),borderRadius:14,padding:12,gap:2},children:[(0,P.jsx)(x.Muted,{children:"CoverCharge \xb7 now"}),(0,P.jsx)(x.T,{weight:"semibold",children:e.title}),(0,P.jsx)(x.T,{size:14,children:e.body})]}),(0,P.jsxs)(x.Muted,{children:["Audience: customers who opted in to ",(0,k.venueInfo)().name," offers. No audience count is available."]}),(0,P.jsx)(x.Button,{label:"Preview (push is off: nothing is sent)",onPress:()=>{m.useOwner.getState().updateOffer(e.id,{pushedAt:`${(0,y.niceDate)(t)} ${t.toTimeString().slice(0,5)}`}),h(null)}})]})})():null]})}function A(){const{r:e}=(0,C.useCtx)(6e4),t=e.settings,[s,n]=(0,c.useState)(t.stampReward);return(0,P.jsxs)(p.default,{style:{gap:10},children:[(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.T,{weight:"semibold",children:"Stamp card"}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Stamps for a reward"}),(0,P.jsx)(x.Stepper,{value:t.stampTarget,min:3,max:15,onChange:t=>M().updateSettings(e.id,{stampTarget:t}),label:"stamps"})]}),(0,P.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(x.T,{children:"Minimum spend"}),(0,P.jsx)(x.Stepper,{value:t.stampMinSpend/100,min:0,max:50,onChange:t=>M().updateSettings(e.id,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,P.jsxs)(x.Muted,{children:[(0,b.gbp)(t.stampMinSpend)," minimum spend per stamp."]}),(0,P.jsx)(x.Field,{label:"Reward",value:s,onChangeText:n}),(0,P.jsx)(x.Button,{small:!0,label:"Save reward",onPress:()=>M().updateSettings(e.id,{stampReward:s.trim()||t.stampReward})})]}),(0,P.jsxs)(x.Card,{children:[(0,P.jsx)(x.Row,{wrap:!0,gap:6,children:Array.from({length:t.stampTarget},(e,t)=>(0,P.jsx)(p.default,{style:{width:28,height:28,borderRadius:14,borderWidth:2,borderColor:w.colours.gold,backgroundColor:t<3?w.colours.gold:'transparent'}},t))}),(0,P.jsxs)(x.Muted,{children:["Preview: 3 of ",t.stampTarget," stamps \xb7 reward: ",t.stampReward]})]})]})}},1500,[805,1033,891,1421,813,812,822,1263,1441,17,385,393,85,864,777,858,876,845,851,863,804,1184,1057,1161,1446,1221,8]); +__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])},1501,[843,17,85,1162,777,858,845,853,863,804,1184,1057,8]); +__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])},1502,[1039,17,85,1503,814,857,777,876,804,1057,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}})},1503,[812,17,219,385,85,780,814,804,777,8]); +__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])},1504,[17,1155,847,1057,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.CashUpPage=function(){const{rid:l,role:u,me:p,meId:f,today:y}=(0,c.useCtx)(6e4),h='owner'===u||'manager'===u,x=(0,s.useSync)(n=>'staff'===n.kind&&!!n.venueId&&'off'!==n.mode&&'local'!==n.mode),v=(0,s.useSync)(n=>n.perms);return x&&!v.includes('*')&&!v.includes('takings.view')?(0,o.jsx)(n.CashUpScreen,{rid:l,today:(0,t.tradingDay)(),canEdit:!0,closer:!0,who:{id:f??'me',name:p.replace(' (example)','')}}):(0,o.jsx)(n.CashUpScreen,{rid:l,today:y,canEdit:h,backdate:h,who:{id:f??'me',name:p.replace(' (example)','')}})},r(d[0]);var n=r(d[1]),c=r(d[2]),s=r(d[3]),t=r(d[4]),o=r(d[5])},1505,[17,1032,1057,899,915,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1506,[17,1401,1057,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TrendLine=b,_e.SpendPerHeadPage=function(){const{rid:e,today:t}=(0,u.useCtx)(6e4),n=(0,o.useBookings)(e),i=(0,d.useCashUp)(e=>e.cashUps),[j,w]=(0,s.useState)('day'),f=(0,h.hasAnyTakings)(i,e),k=(0,l.coverOverridesFor)(e),v=(0,h.dayRows)(i,n,e,t,14,k),$=(0,h.weekRows)(i,n,e,t,8,k),T=(0,h.averageSph)(v),S=(e,s,t,l,n)=>(0,p.jsxs)(a.default,{testID:`sph-row-${e}`,style:{alignItems:'center',paddingVertical:8,borderTopWidth:1,borderTopColor:c.colours.hairline,gap:2},accessible:!0,accessibilityLabel:`${s}: ${'No takings entered'===l?'no takings entered':`spend per head ${l}`}, ${t}${n?`, ${n}`:''}`,children:[(0,p.jsx)(r.T,{center:!0,children:s}),(0,p.jsx)(r.T,{center:!0,colour:c.colours.muted,children:t}),(0,p.jsx)(r.T,{center:!0,weight:"semibold",colour:'No takings entered'===l?c.colours.muted:c.colours.goldLight,size:'No takings entered'===l?13:16,children:l}),n?(0,p.jsx)(r.Muted,{center:!0,children:n}):null]},e);return(0,p.jsxs)(a.default,{style:{gap:12},testID:"sph-screen",children:[(0,p.jsx)(r.Muted,{children:"Tip: spend per head is takings \xf7 Covers. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out."}),(0,p.jsxs)(r.Card,{highlight:c.colours.gold,children:[(0,p.jsx)(r.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"LAST 14 DAYS"}),null==T?(0,p.jsx)(r.T,{size:22,weight:"semibold",colour:c.colours.muted,testID:"sph-none",children:"No takings entered"}):(0,p.jsxs)(r.T,{size:34,weight:"bold",colour:c.colours.goldLight,testID:"sph-avg",children:[x(T)," ",(0,p.jsx)(r.T,{size:16,colour:c.colours.muted,children:"per head"})]}),(0,p.jsx)(r.Muted,{children:f?'Only days with a cash up are counted.':'Nothing has been entered yet. Spend per head appears once a cash up has card and cash totals.'})]}),(0,p.jsxs)(r.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(r.Chip,{testID:"sph-day",label:"By day",selected:'day'===j,onPress:()=>w('day')}),(0,p.jsx)(r.Chip,{testID:"sph-week",label:"By week",selected:'week'===j,onPress:()=>w('week')})]}),'day'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by day"}),(0,p.jsx)(b,{testID:"sph-trend-day",label:"Spend per head trend by day",points:v.map(e=>({label:y(e.date),value:e.sph}))}),[...v].reverse().map(e=>S(e.date,y(e.date),`${e.covers} Covers`,null==e.sph?'No takings entered':x(e.sph),null!=e.foodPh||null!=e.drinkPh?`food ${x(e.foodPh)}, drink ${x(e.drinkPh)} per head`:void 0))]}):null,'week'===j?(0,p.jsxs)(r.Card,{children:[(0,p.jsx)(r.T,{weight:"semibold",children:"Spend per head by week (Mon\u2013Sun)"}),(0,p.jsx)(b,{testID:"sph-trend-week",label:"Spend per head trend by week",points:$.map(e=>({label:`w/c ${y(e.weekStart).split(' ').slice(1).join(' ')}`,value:e.sph}))}),[...$].reverse().map(e=>S(e.weekStart,`w/c ${y(e.weekStart)}`,e.days?`${e.covers} Covers \xb7 ${e.days} day${1===e.days?'':'s'}`:'\u2014',null==e.sph?'No takings entered':x(e.sph)))]}):null,(0,p.jsx)(r.Muted,{children:"Order-at-table totals will be added here when order at table is switched on. Nothing on this page is estimated."})]})};var s=_r(_d[0]),t=e(s),l=_r(_d[1]),a=e(_r(_d[2])),n=_r(_d[3]),i=e(n),r=_r(_d[4]),o=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]);const x=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,y=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function b({points:e,testID:l,label:o}){const[d,h]=(0,s.useState)(320),[u,y]=(0,s.useState)(e.length);(0,s.useEffect)(()=>y(e.length),[e.length,l]);const b=d<340?2:3,j=Math.min(e.length,Math.max(b,u)),w=Math.max(0,j-b),f=e.slice(w,j),k=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*(k-76)/Math.max(1,f.length-1),S=e=>140-e/$*106,L=[];let D=[];f.forEach((e,s)=>{null==e.value?(D.length&&L.push(D),D=[]):D.push({i:s,v:e.value})}),D.length&&L.push(D);const M=e.filter(e=>null!=e.value).map(e=>`${e.label} ${x(e.value)}`).join(', ');return(0,p.jsxs)(a.default,{testID:l,onLayout:e=>h(e.nativeEvent.layout.width),style:{gap:8},children:[(0,p.jsxs)(a.default,{accessible:!0,accessibilityLabel:`${o}. ${M||'No takings entered'}`,style:{flexDirection:'row',minWidth:0},children:[(0,p.jsx)(i.default,{width:64,height:170,children:[0,1,2,3,4].map(e=>(0,p.jsx)(n.Text,{x:60,y:S($*e/4)+4,textAnchor:"end",fontSize:11,fill:c.colours.muted,children:x($*e/4)},e))}),(0,p.jsxs)(i.default,{width:k,height:170,children:[[0,1,2,3,4].map(e=>(0,p.jsx)(n.Line,{x1:0,x2:k,y1:S($*e/4),y2:S($*e/4),stroke:c.colours.border,strokeWidth:1},e)),L.map((e,s)=>(0,p.jsx)(n.Polyline,{points:e.map(e=>`${T(e.i)},${S(e.v)}`).join(' '),fill:"none",stroke:c.colours.gold,strokeWidth:2.5},s)),f.map((e,s)=>(0,p.jsx)(t.default.Fragment,{children:null==e.value?(0,p.jsx)(n.Circle,{cx:T(s),cy:140,r:2,fill:"#444"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.Circle,{cx:T(s),cy:S(e.value),r:4,fill:c.colours.goldLight}),(0,p.jsx)(n.Text,{x:T(s),y:S(e.value)-10,textAnchor:"middle",fontSize:12,fontWeight:"bold",fill:c.colours.goldLight,children:x(e.value)})]})},w+s))]})]}),(0,p.jsx)(a.default,{style:{flexDirection:'row',gap:12},children:f.map((e,s)=>(0,p.jsxs)(a.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityLabel:`${e.label}: ${null==e.value?'No takings entered':x(e.value)}`,children:[(0,p.jsx)(r.T,{center:!0,size:12,colour:c.colours.muted,children:e.label}),(0,p.jsx)(r.T,{center:!0,size:14,weight:"semibold",colour:null==e.value?c.colours.muted:c.colours.goldLight,children:null==e.value?'No takings entered':x(e.value)})]},w+s))}),(0,p.jsxs)(r.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(r.Button,{small:!0,kind:"secondary",label:"Earlier",accessibilityLabel:"Earlier spend per head chart points",disabled:0===w,onPress:()=>y(Math.max(b,j-b))}),(0,p.jsx)(r.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))})]})]})}},1507,[17,1468,85,780,777,858,1008,1470,804,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WebsiteVouchersPage=function(){return(0,n.jsx)(s.default,{testID:"managers-vouchers",style:{minHeight:640,flex:1},children:(0,n.jsx)(u.VoucherList,{mode:"managers"})})},r(d[0]);var e,t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},u=r(d[2]),n=r(d[3])},1508,[17,85,1349,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MyAvatar=function(){const{meId:s,me:c}=(0,n.useCtx)(6e4);return(0,u.jsx)(t.AvatarMaker,{meId:s,me:c})},r(d[0]);var t=r(d[1]),n=r(d[2]),u=r(d[3])},1509,[17,776,1057,8]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BusinessInsights=function(){const{rid:e,now:a,role:I,today:x,signedIn:j}=(0,b.useCtx)(),[D,P]=(0,t.useState)('today'),R=(0,r.useBookings)(e),T=(0,l.useCashUp)(e=>e.cashUps),W=(0,c.useOwner)(e=>(0,c.liveAttendance)(e.attendance)),C=(0,b.useHourly)(),S=(0,$.useReviews)(e=>e.reviews),N=(0,u.canSeeTakingsStats)(I,(0,p.isLive)(),(0,p.can)('takings.view'));(0,t.useEffect)(()=>{(0,v.ensureReviewSync)(e,'manage')},[e]);const M=(0,u.rangeFor)(x,D),L=(0,u.previousRange)(x,D),G=(0,t.useMemo)(()=>R.filter(s=>s.restaurantId===e),[R,e]),_=(0,u.coversInRange)(G,M),O=(0,u.coversInRange)(G,L),B=(0,u.noShowRate)(G,M,e),F=(0,u.noShowRate)(G,L,e),A=(0,u.cancelRate)(G,M,e),H=(0,u.cancelRate)(G,L,e),V='today'===D?(0,h.laterTodayCovers)(G,x):0,z=(0,u.takingsInRange)(T,e,M),U=(0,u.takingsInRange)(T,e,L),E=(0,s.coverOverridesFor)(e),Y=(0,u.spendPerHeadInRange)(T,G,e,M,E),q=(0,u.spendPerHeadInRange)(T,G,e,L,E),J=(0,u.tipsInRange)(T,e,M),K=(0,u.tipsInRange)(T,e,L),Q=(0,t.useMemo)(()=>W.filter(e=>'confirmed'===(0,c.attStatus)(e)).map(e=>({date:e.date,paidMins:(0,b.paidMins)(e,a).paid,ratePence:C[e.staffId]??0})),[W,C,a]),X=(0,t.useMemo)(()=>W.filter(e=>'awaiting'===(0,c.attStatus)(e)).map(e=>e.date),[W]),Z=(0,u.labourVsTakings)(Q,X,T,e,M),ee=(0,u.labourVsTakings)(Q,X,T,e,L),se=(0,u.tipsVsTakings)(T,e,M),te=(0,u.firstVisitDate)(G,e),ae=(0,u.repeatGuestPct)(G,M,e),ne=(0,u.repeatGuestPct)(G,L,e),ie=(0,u.reviewAverage)(S.filter(s=>s.restaurantId===e),M),oe='today'===D?'today':'week'===D?'this week':'this month';return(0,f.jsxs)(n.default,{testID:"business-insights-screen",style:{gap:12,paddingBottom:24},children:[(0,f.jsx)(o.T,{weight:"semibold",size:y.font.title,center:!0,children:"Business insights"}),(0,f.jsx)(o.Muted,{center:!0,children:"Stats and percentages from your bookings, cash ups and confirmed hours. A gap means there is no figure yet, not zero."}),(0,f.jsx)(o.Row,{gap:8,style:{justifyContent:'center',flexWrap:'wrap'},children:k.map(e=>(0,f.jsx)(o.Chip,{testID:`insights-period-${e.id}`,label:e.label,selected:D===e.id,onPress:()=>P(e.id)},e.id))}),(0,f.jsx)(w,{testID:"insights-walkin-pct",label:`Walk-in vs booked \xb7 ${oe}`,value:(0,u.pctLabel)(_.walkInPct),detail:_.empty?void 0:`${_.walkIns} walk-in covers \xb7 ${_.bookings} booked covers \xb7 ${_.total} total`,change:(0,u.changeWords)((0,u.changePct)(_.walkInPct,O.walkInPct),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-noshow-pct",label:`No-show rate \xb7 ${oe}`,value:(0,u.pctLabel)(B.rate),detail:B.empty?void 0:`${B.count} no-show${1===B.count?'':'s'} out of ${B.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(B.rate,F.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-cancel-pct",label:`Cancellation rate \xb7 ${oe}`,value:(0,u.pctLabel)(A.rate),detail:A.empty?void 0:`${A.count} cancelled out of ${A.of} bookings`,change:(0,u.changeWords)((0,u.changePct)(A.rate,H.rate),D),empty:"No bookings in this period"}),(0,f.jsx)(w,{testID:"insights-covers",label:`Covers \xb7 ${oe}`,value:_.empty?null:String(_.total),detail:_.empty?void 0:'today'===D?V>0?`${V} more ${1===V?'cover':'covers'} booked for later today`:'No more bookings for later today':`${_.walkIns} walk-in \xb7 ${_.bookings} booked`,change:(0,u.changeWords)((0,u.changePct)(_.empty?null:_.total,O.empty?null:O.total),D),empty:"No covers yet in this period"}),(0,f.jsx)(w,{testID:"insights-repeat-pct",label:`Repeat guests \xb7 ${oe}`,value:(0,u.pctLabel)(ae.rate),detail:ae.empty?void 0:`${ae.count} of ${ae.of} identifiable seated or finished parties had visited before${te?` (visits on record from ${(0,u.ukDay)(te)})`:''}`,change:(0,u.changeWords)((0,u.changePct)(ae.rate,ne.rate),D),empty:"Not enough guest phone or email details to measure repeat visits"}),(0,f.jsx)(w,{testID:"insights-reviews",label:`Reviews \xb7 ${oe}`,value:ie.empty?null:`${ie.avg} / 5`,detail:ie.empty?void 0:`Average of ${ie.count} published review${1===ie.count?'':'s'}`,empty:"No published reviews in this period"}),(0,f.jsx)(w,{testID:"insights-tips",label:`Tips (team total) \xb7 ${oe}`,value:(0,u.moneyGbp)((0,u.completeTotal)(J,J.tips)),detail:null==J.tips?void 0:N&&null!=se.pct?`${J.days} cash-up day${1===J.days?'':'s'} \xb7 ${(0,u.pctLabel)(se.pct)} of takings on the ${se.days} day${1===se.days?'':'s'} with takings`:`${J.days} cash-up day${1===J.days?'':'s'}`,change:J.missing||K.missing?null:(0,u.changeWords)((0,u.changePct)(J.tips,K.tips),D),empty:J.missing?(0,u.missingWords)(J.missing,'tips figure',J.missingDates):'No tips entered in this period'}),N?(0,f.jsxs)(n.default,{testID:"insights-takings-section",style:{gap:12},children:[(0,f.jsx)(w,{testID:"insights-takings",label:`Takings \xb7 ${oe}`,value:(0,u.moneyGbp)(z.gross),detail:null==z.gross?void 0:`Card + cash \u2212 card tips, from ${z.days}${z.missing?` of ${z.days+z.missing}`:''} confirmed cash-up day${z.days+z.missing===1?'':'s'}${z.missing?`. ${(0,u.takingsMissingWords)(z.missingDates)}`:''}`,change:z.missing||U.missing?null:(0,u.changeWords)((0,u.changePct)(z.gross,U.gross),D),empty:z.missing?(0,u.missingWords)(z.missing,'card or cash total',z.missingDates):'No takings entered in this period'}),(0,f.jsx)(w,{testID:"insights-sph",label:`Spend per head \xb7 ${oe}`,value:(0,u.moneyGbp)(Y.sph),detail:null==Y.sph?void 0:`\xa3${Y.gross.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})} takings \xf7 ${Y.covers} seated or finished covers, on ${Y.days} day${1===Y.days?'':'s'} with both${Y.noCovers?`. ${Y.noCovers} day${1===Y.noCovers?'':'s'} with takings and no Covers (a function, say) count${1===Y.noCovers?'s':''} in takings, not here`:''}`,change:(0,u.changeWords)((0,u.changePct)(Y.sph,q.sph),D),empty:Y.noCovers?'Spend per head needs a day with both takings and seated or finished Covers':'No takings entered, so no spend per head'}),(0,f.jsx)(w,{testID:"insights-labour-pct",label:`Labour % of takings \xb7 ${oe}`,value:(0,u.pctLabel)(Z.pct),detail:null!=Z.pct?`${(0,u.moneyGbp)(Z.labour)} signed-off wages \xf7 ${(0,u.moneyGbp)(Z.gross)} takings, on the ${Z.days} day${1===Z.days?'':'s'} with takings${z.missing?`. ${z.missing} cash up${1===z.missing?'':'s'} with no card or cash total left out`:''}${Z.awaiting?`. ${Z.awaiting} shift${1===Z.awaiting?'':'s'} on those days still need${1===Z.awaiting?'s':''} signing off, not counted yet`:''}`:void 0,change:(0,u.changeWords)((0,u.changePct)(Z.pct,ee.pct),D),empty:j||Object.keys(C).length?null==Z.gross?'Not enough data: no cash up in this period has a card or cash total':'Not enough data: no signed-off hours with a pay rate on the days with takings':'Sign in to see labour against takings'})]}):(0,f.jsx)(n.default,{testID:"insights-takings-hidden",children:(0,f.jsx)(o.Muted,{center:!0,children:"Takings, spend per head and labour % of takings are only shown to owners and managers with See takings."})}),(0,f.jsx)(n.default,{testID:"insights-not-shown",children:(0,f.jsx)(o.Muted,{center:!0,children:u.NOT_SHOWN_YET})})]})};var e,s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),n=(e=a)&&e.__esModule?e:{default:e},o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),c=_r(d[6]),h=_r(d[7]),u=_r(d[8]),p=_r(d[9]),y=_r(d[10]),v=_r(d[11]),$=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const k=[{id:'today',label:'Today'},{id:'week',label:'This week'},{id:'month',label:'This month'}];function w({testID:e,label:s,value:t,detail:a,change:r,empty:l}){const c=!!r&&r.startsWith('Up'),h=!!r&&r.startsWith('Down');return(0,f.jsx)(n.default,{testID:e,children:(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.Muted,{center:!0,children:s}),null==t?(0,f.jsx)(o.T,{testID:`${e}-empty`,weight:"semibold",center:!0,children:l}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.T,{testID:`${e}-value`,weight:"semibold",size:y.font.hero,colour:y.colours.gold,center:!0,children:t}),a?(0,f.jsx)(o.Muted,{center:!0,children:a}):null,r?(0,f.jsx)(o.T,{testID:`${e}-change`,center:!0,colour:c?y.colours.goldLight:h?y.colours.muted:y.colours.text,children:r}):null]})]})})}},1510,[1468,17,85,777,858,1008,876,1055,1469,899,804,1242,1243,1057,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftVouchers=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(q,{})},_e.Merch=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(W,{}):(0,_.jsx)(Y,{})},_e.TablesQr=function({go:e}={}){const{rid:t,r:s,now:n,me:r}=(0,N.useCtx)(1e4);return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(i.StaffTableOrders,{rid:t,me:r}),(0,_.jsx)(v.Muted,{children:"QR codes, tables and hours: Settings \u203a Advanced \u203a Order at the table."})]}):(0,M.orderAtTableOn)(s)?(0,_.jsx)(K,{rid:t,now:n,me:r}):(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Order at table is off",children:"In-house orders go through your till. Switch it on in Settings \u203a Order at table if this venue takes orders at the table."}),e?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Open Order at table settings",onPress:()=>e('more','orderattable')}):null]})},_e.TakeawaySettings=function({go:e}){const{rid:t,r:s,now:n}=(0,N.useCtx)(3e4),a=(0,S.useOrders)(t),r=s.settings,i=(0,P.takeawaySlots)(s,a,n).slice(0,10),l=e=>V().updateSettings(t,e),o=a.filter(e=>'takeaway'===e.type&&(0,I.LIVE)(e));return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:r.takeawayPaused?A.colours.red:A.colours.ok,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:r.takeawayPaused?'Takeaway paused':'Taking takeaway orders'}),(0,_.jsx)(v.Toggle,{label:"Takeaway on",value:!r.takeawayPaused,onChange:e=>l({takeawayPaused:!e})})]}),(0,_.jsx)(v.Muted,{children:"Direct ordering, no delivery-app commission."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Collection slots & capacity"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Slot length (min)"}),(0,_.jsx)(v.Stepper,{value:r.slotMinutes,min:5,max:30,onChange:e=>l({slotMinutes:e}),label:"slot minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Orders per slot"}),(0,_.jsx)(v.Stepper,{value:r.slotCap,min:1,max:20,onChange:e=>l({slotCap:e}),label:"orders per slot"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Earliest pickup (min ahead)"}),(0,_.jsx)(v.Stepper,{value:r.leadMins,min:5,max:60,onChange:e=>l({leadMins:e}),label:"lead minutes"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Readiness buffer (min)"}),(0,_.jsx)(v.Stepper,{value:r.bufferMins,min:0,max:20,onChange:e=>l({bufferMins:e}),label:"buffer minutes"})]}),(0,_.jsx)(v.Muted,{children:"Readiness alerts (start cooking \u2192 bag it \u2192 ready) are for takeaway only, timed from the pickup slot. Dine-in starts when the table is seated and has ordered."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Next slots"}),i.map(e=>(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{size:14,children:e.label}),(0,_.jsx)(w.default,{style:{flex:1,height:8,marginHorizontal:8,backgroundColor:A.colours.border,borderRadius:4},children:(0,_.jsx)(w.default,{style:{width:e.taken/e.cap*100+"%",height:8,backgroundColor:e.full?A.colours.red:A.colours.gold,borderRadius:4}})}),(0,_.jsxs)(v.Muted,{children:[e.taken,"/",e.cap]})]},e.label))]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:["Live queue: ",o.length]}),(0,_.jsx)(v.Button,{small:!0,label:"Open orders",onPress:()=>e('orders')})]}),o.map(e=>(0,_.jsxs)(v.Muted,{children:[e.slotTime?(0,B.hm)(new Date(e.slotTime)):'\u2013'," \xb7 ",e.ref," ",e.customerName," \xb7 ",(0,I.statusLabel)(e)]},e.id))]})]})},_e.BookingSettings=function({go:e}){const{rid:n,r:a}=(0,N.useCtx)(6e4),r=a.settings,i=(0,T.useOwner)(e=>e.reminders),l=e=>V().updateSettings(n,e),o=e=>T.useOwner.getState().setOwner({reminders:{...i,...e}});return(0,_.jsxs)(w.default,{style:{gap:10},children:[t.IS_GREENSIDE?(0,_.jsx)(s.GreensideCashOnly,{}):(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Deposits"}),(0,_.jsxs)(v.Muted,{children:[(()=>{const e=(0,c.depositOf)(r);return e.on&&e.perPersonPence>0?`On: ${(0,R.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more. Children never pay.`:'Off.'})()," Deposits are paid through website bookings: website bookings show Deposit paid on website bookings by themselves; staff tick phone and walk-in deposits paid."]}),(0,_.jsx)(v.Muted,{children:"Tip: change the amount, party size, refunds and the words guests see in Settings \u203a Advanced \u203a Deposits."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Reminders"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 24 hours before"}),(0,_.jsx)(v.Toggle,{label:"24h reminder",value:i.h24,onChange:e=>o({h24:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Reminder 2 hours before"}),(0,_.jsx)(v.Toggle,{label:"2h reminder",value:i.h2,onChange:e=>o({h2:e})})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Ask guests to confirm or cancel"}),(0,_.jsx)(v.Toggle,{label:"confirm",value:i.confirmText,onChange:e=>o({confirmText:e})})]}),(0,_.jsx)(v.Muted,{children:"Guest reminders are not connected; nothing is sent."})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Capacity & waitlist"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Booking start times (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingSlotMinutesOf)(a),min:15,max:30,step:15,onChange:e=>l({bookingSlotMinutes:e}),label:"booking start times"})]}),null!=(0,P.bookingCoversPerStartOf)(a)||null!=(0,P.bookingPartiesPerStartOf)(a)?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerStart??15,min:1,max:60,onChange:e=>l({bookingCoversPerStart:e}),label:"covers at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Bookings at each start time"}),(0,_.jsx)(v.Stepper,{value:r.bookingPartiesPerStart??4,min:1,max:20,onChange:e=>l({bookingPartiesPerStart:e}),label:"bookings at each start time"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, from"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).min,min:1,max:(0,P.onlinePartyBounds)(a).max,onChange:e=>l({onlinePartyMin:e}),label:"online party from"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Online party size, up to"}),(0,_.jsx)(v.Stepper,{value:(0,P.onlinePartyBounds)(a).max,min:(0,P.onlinePartyBounds)(a).min,max:100,onChange:e=>l({onlinePartyMax:e}),label:"online party up to"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Minimum notice (min)"}),(0,_.jsx)(v.Stepper,{value:(0,P.bookingNoticeMinsOf)(a),min:0,max:180,step:5,onChange:e=>l({bookingNoticeMins:e}),label:"minimum notice"})]}),(0,_.jsx)(v.Muted,{children:"Each start time has its own covers and bookings cap, so 19:00 and 19:15 do not share a limit. Last booking is still the closing time. Staff can still book over the limit from New booking."})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Covers per 30-min slot"}),(0,_.jsx)(v.Stepper,{value:r.bookingCoversPerSlot,min:2,max:60,onChange:e=>l({bookingCoversPerSlot:e}),label:"Covers per slot"})]}),(0,_.jsx)(v.Muted,{children:"Guests can pick a start every 15 or 30 minutes. The covers cap is still for each half hour, so 19:00 and 19:15 share the same limit."})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"No limit on how far ahead guests book"}),(0,_.jsx)(v.Toggle,{label:"no limit on how far ahead guests book",value:(0,O.bookAheadUnlimited)(a),onChange:e=>l({onlineBookDaysAhead:e?void 0:90})})]}),(0,O.bookAheadUnlimited)(a)?null:(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Guests can book up to (days ahead)"}),(0,_.jsx)(v.Stepper,{value:(0,O.bookAheadDays)(a),min:1,max:O.SERVER_MAX_DAYS_AHEAD-1,step:7,onChange:e=>l({onlineBookDaysAhead:e}),label:"days ahead guests can book"})]}),(0,_.jsx)(v.Muted,{children:(0,O.bookAheadUnlimited)(a)?'Guests can pick any date up to a year ahead (the most the booking system holds), like the website.':`Guests can book up to ${(0,O.bookAheadDays)(a)} days ahead. Staff can always book further from New booking.`}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Typical table turn (min)"}),(0,_.jsx)(v.Stepper,{value:r.turnMins,min:30,max:180,onChange:e=>l({turnMins:e}),label:"turn minutes"})]}),(0,_.jsx)(v.Muted,{children:"The online waitlist estimate uses the table turn time."}),(0,_.jsx)(v.Button,{small:!0,label:"Open bookings & waitlist",onPress:()=>e('bookings')})]})]})},_e.AllergyHub=function({go:e}){const{rid:t,today:s,role:n,me:a}=(0,N.useCtx)(1e4),[r,i]=(0,b.useState)(null),l=(0,S.useOrders)(t),o=(0,S.useStore)((0,k.useShallow)(e=>e.bookings.filter(e=>e.restaurantId===t&&e.date===s))),d=(0,S.useAudit)(t).filter(e=>'allergy'===e.kind),c=(0,F.useUnsignedDishes)(t),h=(0,S.useStore)(e=>e.bookings),u=l.filter(e=>(0,I.LIVE)(e)&&(0,L.chainNeedsAction)(e,h)).length+o.filter(e=>'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l.filter(I.LIVE))).length,g=(0,N.useSignedIn)(),p=(0,U.cardActorFor)(a,'owner'===n?'owner':'manager'===n?'manager':'staff',g);if('unsigned'===r)return(0,_.jsx)(F.UnsignedDishList,{rid:t,actor:p,onClose:()=>i(null),onOpenCards:()=>e('more','recipecards')});if('pending'===r)return(0,_.jsx)(X,{go:e,onClose:()=>i(null)});const m={flex:1,minHeight:48};return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"info",title:"Supports staff, doesn't replace them",children:"CoverCharge flags the 14 UK allergens and asks a named person to verify. Staff still check with the guest and the recipe every time."}),(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsx)(y.default,{testID:"tile-awaiting-verification",accessibilityRole:"button",accessibilityLabel:`Awaiting verification, ${u}. Opens the list.`,onPress:()=>i('pending'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:u?A.colours.red:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Awaiting verification"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:u})]})}),(0,_.jsx)(y.default,{testID:"tile-not-signed-off",accessibilityRole:"button",accessibilityLabel:`Dishes not signed off, ${c.length}. Opens the list.`,onPress:()=>i('unsigned'),style:({pressed:e})=>[m,{opacity:e?.85:1}],children:(0,_.jsxs)(v.Card,{style:{flex:1,alignItems:'center'},highlight:c.length?A.colours.amber:void 0,children:[(0,_.jsx)(v.Muted,{center:!0,children:"Dishes not signed off"}),(0,_.jsx)(v.T,{center:!0,size:20,weight:"bold",children:c.length})]})})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"1. Allergens per dish (14 UK allergens)"}),(0,_.jsx)(v.Muted,{children:"Each dish\u2019s recipe card lists contains / may contain, suggested from its ingredients. The head chef signs each card off; the menu, takeaway and booking checks all read the cards."}),(0,_.jsx)(v.Button,{small:!0,label:"Recipe cards",onPress:()=>e('more','recipecards')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"2. Kitchen alerts on orders & bookings"}),(0,_.jsx)(v.Muted,{children:"Red allergy cards; cooking is blocked until the Kitchen sign-off."}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,label:"Orders",onPress:()=>e('orders')}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Bookings",onPress:()=>e('bookings')})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"3. Five-step sign-off chain"}),(0,_.jsx)(v.Muted,{children:"Booked, Ordered, Kitchen, Pass and Table: a named person taps Sign off at each step, in order."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"4. Audit log"}),d.slice(0,6).map(e=>(0,_.jsxs)(v.Muted,{children:[(0,B.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)),d.length?null:(0,_.jsx)(v.Muted,{children:"No allergy events yet."}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Full log & daily checks",onPress:()=>e('more','compliance')})]})]})},_e.TabletPreview=function(){return(0,_.jsx)(w.default,{style:{gap:10},children:(0,_.jsxs)(v.Card,{highlight:A.colours.gold,style:{alignItems:'center'},children:[(0,_.jsxs)(w.default,{style:{width:240,height:160,borderRadius:14,borderWidth:3,borderColor:A.colours.border,alignItems:'center',justifyContent:'center'},children:[(0,_.jsx)(v.T,{size:30,children:"\ud83d\udda5\ufe0f"}),(0,_.jsx)(v.T,{weight:"semibold",children:"Kitchen & front-of-house tablet"})]}),(0,_.jsx)(v.T,{size:20,weight:"bold",colour:A.colours.gold,children:"CoverCharge for Display"}),(0,_.jsx)(v.Muted,{center:!0,children:"The in-restaurant tablet and kitchen display is its own app, CoverCharge for Display (landscape). Everything it shows (orders, readiness alerts, allergies, bookings) is also live in this app."})]})})},_e.AllFeatures=function({go:e}){const{role:t,r:s}=(0,N.useCtx)(6e4),n=(0,d.useLiveVenue)(),a=t=>t.startsWith('tab:')?e(t.slice(4)):e('more',t),r=e=>e.startsWith('tab:')?'tab:forecast'!==e||T.CAN.forecasts(t):(()=>{const s=$.PAGES.find(t=>t.id===e);return!!s&&(!s.can||s.can(t))})();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Card,{highlight:A.colours.gold,children:[(0,_.jsx)(v.T,{weight:"semibold",children:"CoverCharge is five apps that share one set of venue data"}),[['CoverCharge for Managers','This app. Run the venue: orders, bookings, forecasts, team, menu, marketing, social posting, billing.','This app'],['CoverCharge for Staff','Clock in/out with break prompt, rota, swaps & leave, chat, my hours & pay, my tips.','Separate app'],['CoverCharge',`For customers: menu, takeaway ordering, table bookings, loyalty, gift cards${(0,M.orderAtTableOn)(s)?', QR table ordering':''}.`,'Separate app'],['CoverCharge for Display','Restaurant tablet / kitchen display: live orders, readiness, allergy alerts.','Separate app'],['CoverCharge for Head Chef','Stock and deliveries, recipe costing and GP, menu engineering, waste, ordering, prep lists, allergens, kitchen compliance, kitchen rota and chat, plus My pay & tips (their own hours, tips, tip goal and paydays only). No other staff pay, customer data or billing.','Separate app']].map(([e,t,s])=>(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"medium",children:e}),(0,_.jsx)(v.Muted,{children:t})]}),(0,_.jsx)(v.Badge,{kind:'This app'===s?'ok':'gold',label:s})]},e)),'owner'===t?(0,_.jsx)(v.Chip,{label:"Open the Staff app preview \u203a",onPress:()=>{T.useOwner.getState().setPreviewRole('staff'),e('home')}}):null,(0,_.jsx)(v.Muted,{children:n?'All five share your venue\u2019s live data. Each is installed separately, and your venue\u2019s own logo leads (Settings \u203a Branding).':'This copy isn\u2019t connected to a venue yet, so it only shows what is saved on this device. Each app is installed separately, and the venue\u2019s own logo leads (Settings \u203a Branding).'})]}),(0,_.jsx)(v.Muted,{children:"Every CoverCharge feature and where to manage it."}),[...J].filter(e=>4!==e.n||(0,M.orderAtTableOn)(s)).sort((e,t)=>e.n-t.n).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{alignItems:'flex-start'},children:[(0,_.jsxs)(v.T,{weight:"bold",colour:A.colours.gold,style:{width:26},children:[e.n,"."]}),(0,_.jsxs)(w.default,{style:{flex:1},children:[(0,_.jsx)(v.T,{weight:"semibold",children:e.title}),(0,_.jsx)(v.Muted,{children:e.note})]})]}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:e.links.filter(([,e])=>r(e)).map(([e,t])=>(0,_.jsx)(v.Chip,{label:`${e} \u203a`,onPress:()=>a(t)},t))})]},e.n))]})},Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v.Divider}}),_e.Loyalty=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"card"}):(0,_.jsx)(H,{})},_e.Referrals=function(){return a.LIVE_VENUE_BUILD||(0,h.staffServer)()?(0,_.jsx)(te,{kind:"referrals"}):(0,_.jsx)(Q,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),r=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),g=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),b=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=e(_r(_d[19])),w=e(_r(_d[20])),k=_r(_d[21]),C=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),T=_r(_d[25]),R=_r(_d[26]),M=_r(_d[27]),P=_r(_d[28]),O=_r(_d[29]),B=_r(_d[30]),A=_r(_d[31]),I=_r(_d[32]),N=_r(_d[33]),D=_r(_d[34]),E=_r(_d[35]),$=_r(_d[36]),L=_r(_d[37]),z=_r(_d[38]),F=_r(_d[39]),U=_r(_d[40]),G=_r(_d[41]),_=_r(_d[42]);const V=()=>S.useStore.getState();function H(){const{rid:e,r:s,me:a}=(0,N.useCtx)(3e4),r=s.settings,i=(0,S.useStore)((0,k.useShallow)(t=>t.stampCards.filter(t=>t.restaurantId===e))),l=(0,S.useStore)(e=>e.customer.name),o=(0,S.useAudit)(e).filter(e=>'stamp'===e.kind),d=(0,b.useMemo)(()=>(0,D.crmCustomers)(),[]),[c,h]=(0,b.useState)(r.stampReward),[u,g]=(0,b.useState)('');(0,b.useEffect)(()=>{(0,E.examplesAllowed)()&&e===t.VENUE_RID&&!i.some(e=>e.customerId.startsWith('cr-'))&&S.useStore.setState(t=>({stampCards:[...t.stampCards,...d.filter(e=>'cust-demo'!==e.id).map((t,s)=>({restaurantId:e,customerId:t.id,stamps:t.stamps%r.stampTarget,rewardsAvailable:s%5==0?1:0,history:[{at:'2026-10-20',source:s%2?'Takeaway':'Dine-in'}]}))]}))},[e]);const p=e=>d.find(t=>t.id===e)?.name??(e===S.useStore.getState().customer.id?l||'Guest':e),m=i.filter(e=>!u||p(e.customerId).toLowerCase().includes(u.toLowerCase())).sort((e,t)=>t.stamps-e.stamps),x=(0,E.examplesAllowed)(),f=o.filter(e=>/redeemed/.test(e.text)).length+(x?31:0);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Active cards"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.length})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Rewards ready"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i.reduce((e,t)=>e+t.rewardsAvailable,0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Redeemed"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:f}),(0,_.jsx)(v.Muted,{children:x?'all time (example)':'all time'})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card settings"}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Stamps for a reward"}),(0,_.jsx)(v.Stepper,{value:r.stampTarget,min:3,max:15,onChange:t=>V().updateSettings(e,{stampTarget:t}),label:"stamps"})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{children:"Min spend \xa3"}),(0,_.jsx)(v.Stepper,{value:r.stampMinSpend/100,min:0,max:50,onChange:t=>V().updateSettings(e,{stampMinSpend:100*t}),label:"minimum spend"})]}),(0,_.jsx)(v.Field,{label:"Reward",value:c,onChangeText:h}),(0,_.jsx)(v.Button,{small:!0,label:"Save reward",onPress:()=>V().updateSettings(e,{stampReward:c.trim()||r.stampReward})}),(0,_.jsx)(v.Muted,{children:"One card per customer account, shared across dine-in, table QR and takeaway."})]}),(0,_.jsx)(I.SectionHead,{title:"Members"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Search members",placeholder:"Search members",placeholderTextColor:"#7D776C",value:u,onChangeText:g,style:v.styles.input}),m.map(t=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:p(t.customerId)}),t.rewardsAvailable?(0,_.jsx)(v.Badge,{kind:"ok",label:`${t.rewardsAvailable} reward ready`}):null]}),(0,_.jsx)(v.Row,{gap:4,children:Array.from({length:r.stampTarget},(e,s)=>(0,_.jsx)(w.default,{style:{flex:1,height:8,borderRadius:4,backgroundColor:se.source))).join(', ')||'\u2013']}),(0,_.jsxs)(v.Row,{gap:6,children:[(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Add stamp",onPress:()=>V().addStamp(e,t.customerId,`Manual (${a})`)}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem reward",disabled:!t.rewardsAvailable,onPress:()=>V().redeemReward(e,t.customerId)})]})]},t.customerId))]})}function Q(){const e=(0,T.useOwner)(e=>e.referral),t=(0,T.useOwner)(e=>e.referrals),[s,n]=(0,b.useState)(e.giverReward),[a,r]=(0,b.useState)(e.friendReward),i=e=>t.filter(t=>t.status===e).length,l=(0,E.examplesAllowed)();return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[l?(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Invites sent"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:"64"}),(0,_.jsx)(v.Muted,{children:"example"})]}):null,(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sign-ups"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:t.length+(l?23:0)})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Ordered"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:i('first order')+i('rewarded')+(l?9:0)})]})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Bring a friend"}),(0,_.jsx)(v.Toggle,{label:"Referrals on",value:e.active,onChange:t=>T.useOwner.getState().setOwner({referral:{...e,active:t}})})]}),(0,_.jsx)(v.Field,{label:"Reward for the customer who invites",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{label:"Reward for the friend (first order)",value:a,onChangeText:r}),(0,_.jsx)(v.Button,{small:!0,label:"Save rewards",onPress:()=>T.useOwner.getState().setOwner({referral:{...e,giverReward:s.trim(),friendReward:a.trim()}})}),(0,_.jsx)(v.Muted,{children:"The inviter\u2019s reward is added to their account after the friend\u2019s first order."})]}),(0,_.jsx)(I.SectionHead,{title:"Referrals"}),t.map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[e.referrer," \u2192 ",e.friend]}),(0,_.jsx)(v.Badge,{kind:'rewarded'===e.status?'ok':'first order'===e.status?'gold':'neutral',label:e.status})]}),(0,_.jsx)(v.Muted,{children:e.at})]},e.id))]})}function W(){const{me:e}=(0,N.useCtx)(6e4),t=(0,N.useSignedIn)();return(0,_.jsx)(p.GiftCardsPage,{me:(t?.name??e).replace(' (example)','')})}function q(){const{rid:e,me:t}=(0,N.useCtx)(6e4),s=(0,S.useStore)((0,k.useShallow)(t=>t.giftCards.filter(t=>t.restaurantId===e))),[a,r]=(0,b.useState)(25),[i,l]=(0,b.useState)(''),[o,d]=(0,b.useState)(''),[c,h]=(0,b.useState)(''),[u,g]=(0,b.useState)(''),[p,m]=(0,b.useState)(''),[x,f]=(0,b.useState)(null),j=s.find(e=>e.code.toUpperCase()===o.trim().toUpperCase()),y=s.find(e=>e.legacy&&e.code.toUpperCase()===u.trim().toUpperCase());return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsxs)(v.Row,{gap:8,children:[(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Sold"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.initial,0))})]}),(0,_.jsxs)(v.Card,{style:{flex:1},children:[(0,_.jsx)(v.Muted,{children:"Outstanding"}),(0,_.jsx)(v.T,{size:20,weight:"bold",children:(0,R.gbp)(s.reduce((e,t)=>e+t.balance,0))})]})]}),x?(0,_.jsx)(v.Banner,{kind:"success",title:x}):null,(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Check balance & redeem"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Gift card code",placeholder:"Code, e.g. ANC-G7QX-4M2P-9TRE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:o,onChangeText:d,style:v.styles.input}),o.trim().length>5?j?(0,_.jsxs)(v.Muted,{children:[j.recipientName," \xb7 balance ",(0,R.gbp)(j.balance)," of ",(0,R.gbp)(j.initial),j.legacy?' \xb7 legacy website bookings':'']}):(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"No card with that code."}):null,(0,_.jsx)(v.Field,{money:!0,label:"Amount to redeem \xa3",value:c,onChangeText:h,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Redeem",disabled:!j||!(Number(c)>0)||100*Number(c)>(j?.balance??0),onPress:()=>{V().redeemGiftCard(o,Math.round(100*Number(c)),t)&&(f(`Redeemed \xa3${Number(c).toFixed(2)} from ${j.code}`),h(''))}})]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,_.jsx)(n.TextInput,{accessibilityLabel:"Website bookings gift card code",placeholder:"Old gift card code, e.g. WEB-OLD-10-EXAMPLE",placeholderTextColor:"#7D776C",autoCapitalize:"characters",value:u,onChangeText:g,style:v.styles.input}),u.trim().length>4?y?(0,_.jsxs)(v.Muted,{children:["Found in imported website bookings cards: balance ",(0,R.gbp)(y.balance),". Redeem it above."]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v.Muted,{children:"Not in the imported list. Check it in your website bookings dashboard, then honour it here:"}),(0,_.jsx)(v.Field,{money:!0,label:"Balance confirmed in website bookings \xa3",value:p,onChangeText:m,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Honour & add to CoverCharge",disabled:!(Number(p)>0),onPress:()=>{const s=V().honourLegacyCard(e,u,Math.round(100*Number(p)),t);f(`Website bookings card ${s.code} honoured`),d(s.code),g(''),m('')}})]}):null]}),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Create / sell a gift card"}),(0,_.jsx)(v.Row,{wrap:!0,gap:6,children:[10,25,50,100].map(e=>(0,_.jsx)(v.Chip,{label:`\xa3${e}`,selected:a===e,onPress:()=>r(e)},e))}),(0,_.jsx)(v.Field,{label:"Recipient",value:i,onChangeText:l}),(0,_.jsx)(v.Button,{label:`Record a \xa3${a} card paid at the till`,disabled:i.trim().length<2,onPress:()=>{const t=V().buyGiftCard(e,100*a,i.trim(),'Sold at the till');f(`Created ${t.code}`),l('')}}),(0,_.jsx)(v.Muted,{children:"Gift cards are sold through your website. Record one here only when it was paid at the till."})]}),(0,_.jsx)(I.SectionHead,{title:"All cards"}),s.map(e=>(0,_.jsxs)(v.Card,{onPress:()=>d(e.code),children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.recipientName}),e.legacy?(0,_.jsx)(v.Badge,{kind:"neutral",label:"Legacy website bookings"}):null]}),(0,_.jsxs)(v.Muted,{children:[e.code," \xb7 ",(0,R.gbp)(e.balance)," of ",(0,R.gbp)(e.initial)]})]},e.id))]})}function K({rid:e,now:t,me:s}){const n=(0,S.useOrders)(e).filter(e=>'table'===e.type),[a,i]=(0,b.useState)(null),l=(0,x.useTableUse)(e,t),o=(0,x.useTableNames)(e);return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Muted,{children:"Each table has its own QR code. Guests scan, order and pay (or split) from their phone. Dine-in cooking starts once the table is seated and has ordered."}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Preview customer table ordering (5)",onPress:()=>j.router.push('/table/5'),testID:"preview-table-ordering"}),(0,_.jsx)(v.Row,{wrap:!0,gap:8,children:o.map(e=>{const t=n.filter(t=>t.tableNo===e&&(0,I.LIVE)(t)),s=t.reduce((e,t)=>e+t.total-t.paid,0);return(0,_.jsxs)(y.default,{accessibilityRole:"button",accessibilityLabel:`Table ${(0,r.tableNumbers)(e)}`,onPress:()=>i(e),style:{width:'31%',padding:10,borderRadius:12,borderWidth:1,borderColor:t.length?A.colours.gold:A.colours.border,backgroundColor:A.colours.surface,gap:2},children:[(0,_.jsx)(v.T,{weight:"bold",children:(0,r.tableNumbers)(e)}),(0,_.jsx)(v.T,{size:12,colour:l[e]?.busy?'#FFD9D4':'#E2C489',children:l[e]?.busy?l[e].label:'Free'}),(0,_.jsx)(v.Muted,{children:t.length?`${t.length} order${t.length>1?'s':''}`:'No orders'}),s?(0,_.jsxs)(v.T,{size:12,colour:A.colours.amber,children:[(0,R.gbp)(s)," to pay"]}):(0,_.jsx)(v.T,{size:12,colour:A.colours.muted,children:"View QR"})]},e)})}),(0,_.jsx)(I.SectionHead,{title:"Live table orders"}),n.filter(I.LIVE).map(e=>(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",children:[(0,r.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,_.jsx)(v.Badge,{kind:(0,I.statusKind)(e.status),label:(0,I.statusLabel)(e)})]}),(0,_.jsxs)(v.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,B.minsBetween)(new Date(e.createdAt),t)," min ago \xb7 ",(0,R.gbp)(e.paid)," of ",(0,R.gbp)(e.total)," paid",e.split?` \xb7 split ${e.split.paidShares}/${e.split.ways}`:'']})]},e.id)),n.filter(I.LIVE).length?null:(0,_.jsx)(v.Muted,{children:"No live table orders."}),a?(0,_.jsxs)(v.Sheet,{visible:!0,onClose:()=>i(null),title:`${(0,r.tableNumbers)(a)} QR code`,children:[(0,_.jsx)(w.default,{style:{alignItems:'center',backgroundColor:'#fff',padding:16,borderRadius:12},children:(0,_.jsx)(C.QR,{value:`https://covercharge.example/t/${e}/${a}`,size:200})}),(0,_.jsxs)(v.Muted,{center:!0,children:["Example link (table ordering links aren\u2019t live yet): covercharge.example/t/",e,"/",a]}),(0,_.jsx)(v.Banner,{kind:"demo",title:"Print later",children:"Printing table cards from here isn\u2019t set up yet. Nothing is printed or sent."}),(0,_.jsx)(v.Button,{label:`Preview customer table ordering (${(0,r.tableNumbers)(a)})`,onPress:()=>{const e=a;i(null),j.router.push(`/table/${e}`)}}),(0,_.jsx)(v.Button,{kind:"secondary",label:"Show the code again",onPress:()=>i(a)})]}):null]})}function X({go:e,onClose:t}){const{rid:s,today:n,role:a}=(0,N.useCtx)(1e4),r=(0,S.useOrders)(s),i=(0,S.useStore)(e=>e.bookings);(0,z.useBackLayer)(!0,t);const l=r.filter(I.LIVE),o=[...l.filter(e=>(0,L.chainNeedsAction)(e,i)).map(e=>{const t=(0,L.nextStep)(e,(0,L.linkedBooking)(e,i)),s=L.CHAIN_STEPS.find(e=>e.id===t);return{id:`o-${e.id}`,at:e.createdAt,title:`${e.ref} \xb7 ${'table'===e.type?`Table ${e.tableNo??''}`.trim():'Takeaway'}${e.customerName?` \xb7 ${e.customerName}`:''}`,when:`Ordered ${(0,B.hm)(new Date(e.createdAt))}`,allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:s?`Next: ${s.n}. ${s.label} sign-off`:'Sign-off waiting',tab:'orders',open:'Open Orders to sign off'}}),...i.filter(e=>e.restaurantId===s&&e.date===n&&'cancelled'!==e.status&&(0,L.bookingNeedsAction)(e,l)).map(e=>({id:`b-${e.id}`,at:`${e.date}T${e.time}`,title:`${e.name} \xb7 ${e.partySize} at ${e.time}`,when:`Booking ${e.ref??''}`.trim(),allergies:e.allergies.map(e=>(0,G.allergenLabel)(e.allergen)).join(', '),next:'Next: 1. Booked sign-off',tab:'bookings',open:'Open Bookings to sign off'}))].sort((e,t)=>e.at.localeCompare(t.at));return(0,_.jsxs)(w.default,{testID:"pending-list",style:{gap:12,alignItems:'stretch'},children:[(0,_.jsx)(z.BackButton,{onPress:t,testID:"pending-back"}),(0,_.jsx)(v.T,{center:!0,size:22,weight:"bold",colour:A.colours.gold,accessibilityRole:"header",style:{alignSelf:'stretch'},children:"Awaiting verification"}),(0,_.jsx)(v.Muted,{center:!0,testID:"pending-status",children:o.length?`${o.length} allergy ${1===o.length?'sign-off':'sign-offs'} waiting, oldest first.`:'Nothing is waiting for an allergy sign-off.'}),o.map(t=>(0,_.jsxs)(v.Card,{highlight:A.colours.red,style:{alignItems:'center',gap:8},children:[(0,_.jsxs)(w.default,{testID:`pending-row-${t.id}`,accessible:!0,accessibilityLabel:`${t.title}, ${t.when}, allergies: ${t.allergies}. ${t.next}.`,style:{alignItems:'center',gap:4,width:'100%'},children:[(0,_.jsx)(v.T,{center:!0,weight:"bold",size:18,children:t.title}),(0,_.jsx)(v.T,{center:!0,children:t.when}),(0,_.jsxs)(v.Muted,{center:!0,children:["Allergies: ",t.allergies]}),(0,_.jsx)(v.T,{center:!0,colour:A.colours.gold,children:t.next})]}),(0,_.jsx)(v.Button,{small:!0,label:t.open,onPress:()=>e(t.tab),style:{alignSelf:'stretch'}})]},t.id)),'owner'===a||'manager'===a?(0,_.jsx)(v.Button,{small:!0,kind:"secondary",label:"Allergen sign-off log",onPress:()=>e('more','allergen-signoffs')}):null]})}function Y(){const e=(0,T.useOwner)(e=>e.merch),t=(0,T.useOwner)(e=>e.merchOrders),[s,n]=(0,b.useState)(''),[a,r]=(0,b.useState)(''),i=(t,s)=>T.useOwner.getState().setOwner({merch:e.map(e=>e.id===t?{...e,...s}:e)});return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(v.Banner,{kind:"demo",title:"Optional add-on",children:"Sell branded items in the customer app for collection. Example only on this device; nothing is charged."}),(0,_.jsx)(I.SectionHead,{title:"Products & stock"}),e.map(e=>(0,_.jsxs)(w.default,{style:v.styles.card,children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(v.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,_.jsx)(v.T,{children:(0,R.gbp)(e.price)})]}),(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsx)(w.default,{style:{flex:1,minWidth:0},children:(0,_.jsx)(v.Toggle,{label:e.live?'In shop':'Hidden',a11y:`${e.name} live`,value:e.live,onChange:t=>i(e.id,{live:t})})}),(0,_.jsx)(v.Stepper,{value:e.stock,min:0,max:500,onChange:t=>i(e.id,{stock:t}),label:`${e.name} stock`})]}),0===e.stock?(0,_.jsx)(v.T,{size:13,colour:A.colours.red,children:"Out of stock"}):e.stock<8?(0,_.jsx)(v.T,{size:13,colour:A.colours.amber,children:"Low stock"}):null]},e.id)),(0,_.jsxs)(v.Card,{children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Add a product"}),(0,_.jsx)(v.Field,{label:"Name",value:s,onChangeText:n}),(0,_.jsx)(v.Field,{money:!0,label:"Price \xa3",value:a,onChangeText:r,keyboardType:"decimal-pad"}),(0,_.jsx)(v.Button,{small:!0,label:"Add product",disabled:s.trim().length<2||!(Number(a)>0),onPress:()=>{T.useOwner.getState().setOwner({merch:[...e,{id:`mc-${Date.now()}`,name:s.trim(),price:Math.round(100*Number(a)),stock:10,live:!0}]}),n(''),r('')}})]}),(0,_.jsx)(I.SectionHead,{title:"Shop orders"}),t.map(s=>{const n=e.find(e=>e.id===s.productId);return(0,_.jsxs)(v.Card,{children:[(0,_.jsxs)(v.Row,{style:{justifyContent:'space-between'},children:[(0,_.jsxs)(v.T,{weight:"semibold",style:{flex:1},children:[s.qty,"\xd7 ",n?.name," \xb7 ",s.customer]}),(0,_.jsx)(v.Badge,{kind:'new'===s.status?'amber':'ready'===s.status?'blue':'ok',label:s.status})]}),(0,_.jsxs)(v.Muted,{children:[s.at," \xb7 ",(0,R.gbp)((n?.price??0)*s.qty)]}),'collected'!==s.status?(0,_.jsx)(v.Button,{small:!0,label:'new'===s.status?'Mark ready':'Mark collected',onPress:()=>T.useOwner.getState().setOwner({merchOrders:t.map(e=>e.id===s.id?{...e,status:'new'===s.status?'ready':'collected'}:e)})}):null]},s.id)})]})}const J=[{n:1,title:'Loyalty stamp card',links:[['Stamp card','loyalty']],note:'Settings, members, add/redeem, stats. One card across dine-in & takeaway.'},{n:2,title:'Bring-a-friend referrals',links:[['Referrals','referrals']],note:'Rewards, referral list and stats.'},{n:3,title:'Gift cards & vouchers',links:[['Gift cards','giftcards']],note:'Sold through your website. Check a balance, take it off the bill, honour website bookings cards.'},{n:4,title:'QR order & pay at table',links:[['Tables & QR codes','tables']],note:'Table list, QR per table, live table orders.'},{n:5,title:'Direct takeaway ordering',links:[['Takeaway settings','takeaway'],['Orders','tab:orders']],note:'Slots, capacity, live queue, readiness alerts (takeaway only).'},{n:6,title:'Table bookings, no-shows & waitlist',links:[['Bookings','tab:bookings'],['Booking settings','bookingsettings']],note:'Deposits (Deposit due / paid, set in Settings \u203a Advanced), no-show marking, reminders, online waitlist.'},{n:7,title:'Allergy verification',links:[['Allergy hub','allergy'],['Menu & allergens','menu']],note:'14 UK allergens per dish, kitchen alerts, named verification, audit log.'},{n:8,title:'Push offers & specials (opt-in)',links:[['Marketing','marketing'],['Specials & offers','offers']],note:'Saved campaign drafts. Delivery is not connected.'},{n:9,title:'Calendar & marketing hooks',links:[['Forecast calendar','tab:forecast'],['Events','events']],note:'Scottish bank holidays, school holidays, local & own events, promo hooks.'},{n:10,title:'Private feedback',links:[['Feedback inbox','feedback'],['Reviews','reviews']],note:'Low-rating alerts. No review gating.'},{n:11,title:'Lost property & coat check',links:[['Lost property','lost']],note:'Found items and coat-check tickets.'},{n:12,title:'Merch shop (optional)',links:[['Merch shop','merch']],note:'Products, stock and orders.'},{n:14,title:'Staff group chat',links:[['Chat','tab:chat']],note:'Channels, DMs, photos, reactions, read receipts, pins, auto-posts, cover requests. Local only.'},{n:16,title:'Suppliers',links:[['Suppliers','suppliers'],['Prep & stock list','prep']],note:'Contacts, categories, favourites, cut-offs and delivery days, tap to call/email/website, orders due today, order log, staff permission.'},{n:17,title:'Hours & pay',links:[['My hours & pay','mypay'],['Payroll & pay rates','payroll'],['Timesheets','timesheets']],note:'Staff see their own hours and gross pay (before tax, estimate) plus tips; owner sets hourly rates and sees the team payroll summary.'},{n:15,title:'Tip splitter',links:[['Tips','tips'],['My tips','mytips']],note:'Pay periods, card + cash pot, 4 split methods, approve & lock, compliance checklist.'},{n:18,title:'Post to social',links:[['Post to social','social'],['Connected accounts','socialaccounts'],['Marketing','marketing']],note:'Social publishing is not connected. No accounts are linked and nothing is posted.'},{n:20,title:'Head Chef app',links:[['Menu & allergens','menu'],['Suppliers','suppliers']],note:'CoverCharge for Head Chef: stock with par levels and alerts, stock take, deliveries checked against the order, recipe cards with dish cost, GP % and cash GP against a target, price-change impact, theoretical vs actual GP, menu engineering, waste log, ordering from par and forecast, prep lists, 14-allergen matrix with sign-off, temperatures, cleaning and daily checks, kitchen rota, chat, live tickets and a Sold out list (a reminder for staff, shown on the Display). Uses this menu and these suppliers.'},{n:21,title:'Branding',links:[['Branding','branding']],note:'Your logo and accent colour lead all five apps, with a small "powered by CoverCharge". Pick any colour with the colour picker or a hex code; text on it stays readable.'},{n:19,title:'Quick links',links:[['Quick links','quicklinks'],['Dashboard','tab:home']],note:'One-tap Work email (Gmail) and Website bookings view/edit for owners and managers, plus up to 6 of your own links. Staff never see the website bookings links; per-link staff visibility for the rest (off by default). Head Chef: no quick links or email at all. Opens the app or site only.'},{n:13,title:'Forecasting, dashboard & running the business',links:[['Forecast','tab:forecast'],['Dashboard','tab:home'],['Tablet preview','tablet'],['Rota','rota'],['Clock in/out','clock'],['Timesheets','timesheets'],['Analytics','analytics'],['CRM','crm'],['Plan & billing','plan']],note:'Headline forecast, rotas, geofenced clock in/out with break prompt, analytics, CRM'+f.PLAN_FEATURE_NOTE+'.'}];const Z=async e=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(e)}catch{return!1}},ee=async e=>{try{'undefined'!=typeof localStorage&&localStorage.setItem(e,'1')}catch{}};function te({kind:e}){const{r:t}=(0,N.useCtx)(6e4),s=(0,T.useOwner)(e=>e.offers);(0,b.useEffect)(()=>{(0,h.migrateLocalOnce)({offers:s},Z,ee).catch(()=>{})},[]);const n=(0,u.can)('venue.settings');return(0,_.jsxs)(w.default,{style:{gap:10},children:[(0,_.jsx)(m.LoyaltySummaryCard,{kind:e}),(0,_.jsx)(g.StaffLoyalty,{venue:t.name,canRemove:n,onOpenSettings:n?()=>{l.advancedPrefill.q='loyalty',o.useVoiceNav.getState().go?.('more','advanced')}:void 0}),n?(0,_.jsx)(v.Card,{children:(0,_.jsxs)(w.default,{style:{gap:8},children:[(0,_.jsx)(v.T,{weight:"semibold",children:"Card, offers and bring-a-friend settings"}),(0,_.jsx)(m.LoyaltySettingsPanel,{})]})}):null]})}},1511,[805,1421,812,822,843,1512,1440,1490,1228,841,1263,899,1513,1515,1441,17,1098,1498,13,385,85,864,1281,777,858,876,851,866,1105,1252,863,804,1184,1057,1139,869,1459,853,1026,1155,847,845,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1512,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1513,[899,17,264,219,85,1281,777,1260,1263,804,1514,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1514,[17,219,85,777,1260,8]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1515,[805,1421,17,85,777,851,1260,1261,1262,899,1263,804,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return I}}),_e.AssistantFab=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)(e=>e.enabled);return v(e)&&t?(0,C.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>I.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:j.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,C.jsx)(D,{size:22}),(0,C.jsx)(p.T,{weight:"bold",colour:T,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=I(e=>e.open),o=()=>I.getState().setOpen(!1),{rid:h,role:w,me:A}=(0,k.useCtx)(3e4),T=(0,y.useAssistant)(),B=M(),[P,E]=(0,a.useState)([]),[L,W]=(0,a.useState)(''),[z,$]=(0,a.useState)(!1),_=(0,a.useRef)(null);(0,a.useRef)(null);if((0,a.useEffect)(()=>{setTimeout(()=>_.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!v(w))return null;const N=(e,t,s)=>y.useAssistant.getState().record({at:(new Date).toISOString(),by:A,role:w,asked:e,action:t,outcome:s}),F=(e,t="result")=>E(s=>[...s,{id:R(),from:'assistant',text:e,kind:t}]),H=async e=>{const t=e.trim();if(!t)return;let s;W(''),E(e=>[...e,{id:R(),from:'you',text:t}]);try{s=await(0,x.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),E(e=>[...e,{id:R(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>E(s=>s.map(s=>s.id===e?{...s,state:t}:s)),G=async(e,t,n)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(n??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void F(S,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await f.repo.bookings.seatWalkIn(h,Number(o.party),s,'Added by Assistant'),s&&(0,b.resetTableLive)(h,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':(0,s.setSoldOut)(String(o.itemId),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 f.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':m.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')}},V=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),F('Cancelled. Nothing was changed.','note')},q='lite'===T.tier,K=(0,y.tasksUsed)(T);return(0,C.jsx)(l.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:o,children:(0,C.jsx)(u.default,{style:[p.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,C.jsxs)(u.default,{testID:"assistant-sheet",style:{backgroundColor:j.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:j.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.Row,{gap:8,style:{flex:1},children:[(0,C.jsx)(u.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:18})}),(0,C.jsx)(p.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,C.jsx)(n.GoldClose,{testID:"assistant-close",onPress:o,style:{marginRight:-6}})]}),(0,C.jsx)(u.default,{testID:"assistant-demo-badge",children:(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,C.jsxs)(u.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,C.jsx)(p.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,C.jsx)(p.Button,{kind:"secondary",label:"Close",onPress:o})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(c.default,{ref:_,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,C.jsxs)(u.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,C.jsxs)(p.T,{children:["Hi ",A.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,C.jsx)(p.Muted,{children:"Try:"}),x.SUGGESTED_PROMPTS.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:j.colours.surface2},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,C.jsx)(u.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,C.jsx)(p.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,C.jsx)(O,{m:e,onConfirm:(t,s)=>G(e,t,s),onCancel:()=>V(e)},e.id):'choose'===e.proposal.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),(0,C.jsx)(p.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>H(e.prompt)},e.label))})]},e.id):(0,C.jsxs)(u.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,C.jsx)(p.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,C.jsx)(r.default,{accessibilityRole:"button",onPress:()=>H(e),style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:8},children:(0,C.jsx)(p.T,{size:14,children:e})},e))]},e.id):(0,C.jsx)(u.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?j.colours.amberBg:j.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:j.colours.amber},children:(0,C.jsx)(p.T,{children:e.text})},e.id))]}),(0,C.jsxs)(p.Row,{gap:8,children:[(0,C.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:L,onChangeText:W,onSubmitEditing:()=>H(L),returnKeyType:"send",style:[p.styles.input,{flex:1,minWidth:0,width:40}]}),null,(0,C.jsx)(p.Button,{label:"Send",accessibilityLabel:"Send",disabled:!L.trim(),onPress:()=>H(L)})]}),(0,C.jsxs)(p.Muted,{center:!0,children:["Demo on this device \xb7 ",K," of ",y.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,k.useCtx)(6e4),s=(0,y.useAssistant)();return v(t)?(0,C.jsxs)(u.default,{style:{gap:12},children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{gap:10,children:[(0,C.jsx)(u.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:j.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(D,{size:22})}),(0,C.jsxs)(u.default,{style:{flex:1},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,C.jsx)(p.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,C.jsx)(p.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>I.getState().setOpen(!0)}),(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,C.jsxs)(u.default,{testID:"assistant-log",style:{gap:6},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>y.useAssistant.getState().clearLog()}):null]}),(0,C.jsx)(p.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,C.jsx)(p.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,C.jsxs)(u.default,{style:{borderWidth:1,borderColor:j.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(p.T,{size:12,colour:j.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,C.jsx)(p.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,C.jsxs)(p.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,C.jsxs)(p.T,{size:13,colour:j.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,C.jsx)(p.Muted,{children:"The activity log is visible to the owner."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,k.useCtx)(6e4),t=(0,y.useAssistant)();return v(e)?(0,C.jsxs)(u.default,{style:{gap:12},testID:"assistant-settings",children:[(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,C.jsx)(p.Muted,{children:"Shows the gold Assistant button on every Managers screen."})]}),(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,C.jsxs)(u.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:j.colours.border,paddingTop:8},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{children:e.name}),(0,C.jsx)(p.Badge,{kind:"neutral",label:"Not connected"})]}),(0,C.jsxs)(p.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,C.jsx)(p.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,C.jsxs)(p.Card,{children:[(0,C.jsx)(p.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,C.jsx)(p.Muted,{children:"The Assistant comes with Full Restaurant Pro App, SuperPro 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,C.jsx)(p.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to CoverCharge\u2019s server to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,C.jsx)(p.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,y.useAssistant)(),t=(0,y.tasksUsed)(e),s=Math.min(1,t/y.FAIR_USE);return(0,C.jsxs)(p.Card,{children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,C.jsx)(p.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,C.jsx)(u.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${y.FAIR_USE} tasks used`,style:{height:8,backgroundColor:j.colours.border,borderRadius:4},children:(0,C.jsx)(u.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:j.colours.gold,borderRadius:4}})}),(0,C.jsxs)(p.Muted,{children:[t," of ",y.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]);_r(d[4]);var a=_r(d[5]),l=e(_r(d[6]));_r(d[7]);var r=e(_r(d[8])),c=e(_r(d[9])),u=e(_r(d[10])),h=_r(d[11]),p=_r(d[12]),b=_r(d[13]),f=_r(d[14]),m=_r(d[15]),x=_r(d[16]),y=_r(d[17]),j=_r(d[18]),k=_r(d[19]),w=_r(d[20]),C=_r(d[21]);const A=!0,S='Nothing was sent or changed: this connection is not set up yet.',T='#1A1408',I=(0,h.create)(e=>({open:!1,setOpen:t=>e({open:t})})),v=e=>'owner'===e||'manager'===e,R=()=>Math.random().toString(36).slice(2,9);function D({size:e=24,colour:t=T}){return(0,C.jsx)(p.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function M(){const{rid:e,r:t,now:s,today:n}=(0,k.useCtx)(3e4),l=(0,f.useAllMenu)(e),r=(0,b.useTableNames)(e),c=(0,f.useBookings)(e),u=(0,m.useOwner)(e=>e.staff),h=(0,m.useOwner)(e=>e.shifts),p=(0,m.useOwner)(e=>e.offers),x=(0,m.useOwner)(e=>e.suppliers);return(0,a.useMemo)(()=>({venue:t.name,now:s.toISOString(),menu:l.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:r,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:(0,w.workingShifts)(h,m.useOwner.getState().leave).filter(e=>e.published&&e.date>=(0,m.addDays)(n,-(0,m.weekdayOf)(n))&&e.date<=(0,m.addDays)(n,6-(0,m.weekdayOf)(n))),bookingsToday:c.filter(e=>e.date===n).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:p.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,o.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,s.getMinutes(),l,r,c,u,h,p,x])}function O({m:e,onConfirm:s,onCancel:n}){const o=e.proposal,[l,r]=(0,a.useState)(!1),[c,h]=(0,a.useState)('external'===o.kind?o.text:''),b='open'===e.state;return'inapp'!==o.kind&&'external'!==o.kind?null:(0,C.jsxs)(u.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?j.colours.gold:j.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:j.colours.surface2},children:[(0,C.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(p.T,{weight:"semibold",style:{flex:1},children:o.title}),'external'===o.kind?(0,C.jsx)(p.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,C.jsx)(p.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===o.kind?(0,C.jsxs)(u.default,{style:{gap:6},children:[o.detail?(0,C.jsx)(p.Muted,{children:o.detail}):null,(0,C.jsx)(p.T,{size:14,colour:j.colours.muted,children:o.label}),l&&b?(0,C.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:c,onChangeText:h,style:[p.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,C.jsx)(u.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:j.colours.gold,paddingLeft:10},children:(0,C.jsxs)(p.T,{children:["\u201c",c,"\u201d"]})}),(0,C.jsxs)(p.Muted,{children:["Sends to: ",o.service.map(e=>x.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,C.jsxs)(u.default,{style:{gap:4},children:[(0,C.jsx)(p.Muted,{children:o.detail}),o.warning?(0,C.jsxs)(p.T,{size:13,colour:j.colours.amber,children:["\u26a0 ",o.warning]}):null]}),b?(0,C.jsxs)(p.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(p.Button,{small:!0,label:'inapp'===o.kind?o.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(o,c)}),'external'===o.kind?(0,C.jsx)(p.Button,{small:!0,kind:"secondary",label:l?'Done editing':'Edit',testID:"edit-action",onPress:()=>r(!l)}):null,(0,C.jsx)(p.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,C.jsx)(p.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,C.jsxs)(p.Muted,{children:["Nothing happens until you tap ",'inapp'===o.kind?o.confirmLabel:'Confirm',"."]}):null]})}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'}]},1516,[812,891,779,869,1217,17,378,219,385,278,85,831,777,1098,858,876,1517,1521,804,1057,1071,8]); +__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]}})})},1517,[1518,1520,1519]); +__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)}},1518,[843,1519]); +__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'}},1519,[]); +__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:'Assistant (server, with on-device fallback)',interpret:s}},1520,[1518,1218]); +__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},1521,[869,824,831,834]); +__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 w}}),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]),l=r(d[7]),x=r(d[8]),p=r(d[9]),C=r(d[10]);const w={Creator:()=>{const{rid:n,role:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(t.DishCreator,{rid:n,canPublish:'owner'===s||'manager'===s})},Prices:()=>(0,C.jsx)(j,{initial:"prices"}),Kitchen:()=>(0,C.jsx)(j,{initial:"deliveries"}),Haccp:()=>{const{me:n,meId:t,now:o,rid:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(s.HaccpLog,{mode:"managers",me:n,meId:t,now:o,rid:u})},Specials:()=>{const{rid:n,me:t,now:s}=(0,c.useCtx)(3e4);return(0,C.jsx)(o.SpecialsEditor,{rid:n,me:t,app:"managers",now:s})},Accidents:()=>{const{me:t,meId:s,now:o,role:u}=(0,c.useCtx)(3e4);return(0,C.jsx)(n.AccidentBook,{app:"managers",me:t,meId:s,now:o,seeAll:'owner'===u||'manager'===u})}};function j({initial:n}){const{rid:t,role:s,me:o}=(0,c.useCtx)(3e4),w=(0,c.useSignedIn)(),j=x.IS_CAR?p.CAR_ACTOR:o;return(0,C.jsx)(u.KitchenCosts,{rid:t,me:j,actor:(0,l.cardActorFor)(j,'owner'===s?'owner':'manager'===s?'manager':'staff',w),initial:n})}},1522,[17,1212,1157,1213,1225,1057,1175,847,856,993,8]); +__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 u}}),_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),[w,v]=(0,t.useState)(null),[f,k]=(0,t.useState)(null),C=async()=>{try{v(await(0,o.carList)())}catch{v([])}};(0,t.useEffect)(()=>{e&&C()},[e]);const D=n.replace(/\D/g,''),I=async()=>{j(!0),y(null);const e=await(0,o.carApprove)(D);j(!1),e.ok?(c(''),y({ok:!0,text:'Done. The car is paired as an owner device. It opens in a few seconds. Nobody is signed in on the car.'}),C()):y({ok:!1,text:e.message})};return(0,h.jsxs)(r.default,{testID:"car-screen-page",style:{gap:12},children:[(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Pair the car"}),(0,h.jsx)(s.T,{center:!0,children:`In the car, while parked, open the browser and type ${u}`}),(0,h.jsx)(s.T,{center:!0,children:"The car shows 6 numbers on its screen. Only an owner can approve this."}),(0,h.jsx)(s.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,h.jsx)(s.Button,{testID:"car-approve",label:x?'Approving\u2026':'Approve car',accessibilityHint:"Pairs the car as an owner device",disabled:!e||x||6!==D.length,onPress:()=>{I()},style:{minHeight:56}}),e?null:(0,h.jsx)(s.Muted,{center:!0,children:"Your phone needs to be connected, and you need to be an owner, to approve a car."}),(0,h.jsx)(r.default,{accessibilityLiveRegion:"polite",accessible:!!b,accessibilityLabel:b?.text,children:b?(0,h.jsx)(s.T,{testID:"car-approve-msg",center:!0,weight:"semibold",colour:b.ok?l.colours.goldLight:l.colours.amber,children:b.text}):null}),(0,h.jsx)(s.Muted,{center:!0,children:"Never open your personal app link in the car. It stays on this phone."})]}),(0,h.jsxs)(s.Card,{children:[(0,h.jsx)(s.T,{center:!0,size:18,weight:"semibold",colour:l.colours.goldLight,accessibilityRole:"header",children:"Cars paired"}),null===w?(0,h.jsx)(s.Muted,{center:!0,children:e?'Loading\u2026':'Shown once your phone is connected.'}):w.length?w.map(e=>(0,h.jsxs)(r.default,{testID:`car-row-${e.id}`,style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:l.colours.border},children:[(0,h.jsx)(s.T,{center:!0,weight:"semibold",children:`${e.label} \xb7 paired`}),(0,h.jsx)(s.Muted,{center:!0,children:`Since ${p(e.approvedAt)}. Last seen ${p(e.lastSeenAt)}.`}),(0,h.jsx)(s.Button,{testID:`car-revoke-${e.id}`,kind:"secondary",label:"Unpair this car",accessibilityLabel:`Unpair ${e.label}`,onPress:()=>k(e),style:{minHeight:56}})]},e.id)):(0,h.jsx)(s.Muted,{center:!0,children:"No cars are paired."})]}),f?(0,h.jsxs)(s.Sheet,{visible:!0,onClose:()=>k(null),title:"Unpair this car?",maxWidth:520,testID:"car-revoke-confirm",children:[(0,h.jsx)(s.T,{center:!0,children:`${f.label} stops working straight away. To use it again, make a new code in the car and approve it here as an owner.`}),(0,h.jsx)(s.Button,{testID:"car-revoke-yes",label:"Yes, unpair it",onPress:async()=>{const e=f;k(null);const t=await(0,o.carRevoke)(e.id);y(t.ok?{ok:!0,text:`${e.label} is unpaired.`}:{ok:!1,text:t.message}),C()},style:{minHeight:56}}),(0,h.jsx)(s.Button,{kind:"secondary",label:"Cancel",onPress:()=>k(null),style:{minHeight:56}})]}):null]})};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),c=_r(d[4]),l=_r(d[5]),h=_r(d[6]);const u='covercharge-apps.static.hf.space/car',p=e=>e?`${(0,c.niceDate)(new Date(e))} at ${(0,c.hm)(new Date(e))}`:'not yet'},1523,[17,85,777,899,863,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.EmailFrame=v,_e.SmsBubble=C,_e.AlertSettings=function({go:e}){const{rid:s}=(0,T.useCtx)(6e4),t=(0,p.useAlerts)(e=>e.prefs),[l,o]=(0,n.useState)((0,p.systemSupport)()),r='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,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Alert sound"}),(0,k.jsx)(h.Badge,{kind:t.muted?'neutral':'gold',label:t.muted?'Muted':'On'})]}),(0,k.jsx)(h.Toggle,{label:"Play a chime when an alert arrives",value:!t.muted,onChange:e=>p.useAlerts.getState().setPrefs({muted:!e})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the chime",onPress:()=>(0,y.chime)('bright')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Play the kitchen chime",onPress:()=>(0,y.lowChime)(.6)})]}),(0,k.jsx)(h.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,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Which alerts to show"}),(0,k.jsx)(h.Muted,{children:"Switched-off alerts still go into the list behind the bell, quietly."}),p.ALERT_KINDS.filter(e=>'test'!==e).map(e=>(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindChip,{kind:e,size:30}),(0,k.jsx)(c.default,{style:{flex:1},children:(0,k.jsx)(h.Toggle,{label:p.KIND_META[e].label,value:!1!==t.types[e],onChange:s=>p.useAlerts.getState().setType(e,s)})})]},e))]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Send a test alert"}),(0,k.jsx)(h.Muted,{children:"Shows each alert here (and as a phone notification if allowed). Tests are clearly labelled and never touch real bookings."}),(0,k.jsx)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:['booking','pending','takeaway','email'].map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",testID:`test-alert-${e}`,label:`Test: ${p.KIND_META[e].label.toLowerCase()}`,onPress:()=>(0,p.sendTestAlert)(s,e)},e))})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Phone and desktop notifications"}),(0,k.jsx)(h.Badge,{kind:'granted'===l?'ok':'denied'===l?'red':'neutral',label:'granted'===l?'On':'denied'===l?'Blocked':'default'===l?'Off':'Not available'})]}),(0,k.jsx)(h.Muted,{children:r}),(0,k.jsx)(h.Toggle,{label:"Pop up alerts when the app is in the background",value:t.system,onChange:e=>p.useAlerts.getState().setPrefs({system:e})}),'default'===l?(0,k.jsx)(h.Button,{small:!0,label:"Allow notifications",onPress:async()=>{o(await(0,p.requestSystemPermission)()),p.useAlerts.getState().setAsked()}}):null,'granted'===l?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Show a test notification",onPress:()=>(0,p.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,k.jsx)(h.Muted,{children:(0,p.isInstalled)()?'Installed on this device.':'Tip: install the Managers app (Add to Home Screen) for the most reliable alerts.'}),(0,k.jsx)(h.T,{weight:"semibold",style:{marginTop:6},children:"Alerts when the phone is locked"}),(0,k.jsx)(w.PhoneAlerts,{what:"booking alerts (new, changed, cancelled, no-show) and your reminders"})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(u.KindIcon,{kind:"email"}),(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:"Venue email"}),(0,k.jsx)(h.Badge,{kind:"neutral",label:p.CONNECTED_INBOX?'Connected':'Not connected'})]}),(0,k.jsx)(h.Muted,{children:p.CONNECTED_INBOX?'New emails to your venue inbox pop up as alerts.':`${p.INBOX_EMPTY}. Once connected, we\u2019ll show who it\u2019s from and the subject, never the whole message on the Display.`})]}),(0,k.jsx)(h.Button,{kind:"ghost",label:"Open alert history",onPress:()=>e('more','notifications')})]})},_e.GuestTemplates=function(){const{rid:e,r:s,today:o}=(0,T.useCtx)(6e4),r=(0,m.useStore)(s=>s.msgTemplates[e]),u=(0,n.useMemo)(()=>(0,j.templatesFor)(r),[r]),p=(0,x.useAssistant)(e=>e.enabled)&&b.ASSISTANT_UI,[y,w]=(0,n.useState)('booking'),[A,M]=(0,n.useState)('sms'),B=u[y],I=s=>m.useStore.getState().setTemplate(e,y,s),R=Object.fromEntries(j.PLACEHOLDERS.map(e=>[e.key,`{${e.key}}`])),L=l.LIVE_VENUE_BUILD?{sms:R,email:R}:'order'===y?(0,j.orderVars)({...E,slotTime:`${o}T18:45:00`},s):(0,j.bookingVars)({...S,date:o},s),N=(0,j.toGsm)((0,j.fill)(B.sms,L.sms)),_=(0,j.fill)(B.subject,L.email),D=(0,j.emailHtml)((0,j.fillEmailText)(B.body,L.email),{venue:s.name,preheader:_}),O=!!r?.[y],V=s.settings;return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"demo",title:"Preview mode",children:j.PREVIEW_BANNER}),(0,k.jsxs)(h.Muted,{children:["CoverCharge confirms every booking and takeaway order by email. Edit the wording here. Words in ",'{curly brackets}'," are filled in for each guest. If the guest booked through the website, the website may also send its own confirmation, including by text."]}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:Object.keys(j.DEFAULT_TEMPLATES).map(e=>(0,k.jsx)(h.Chip,{label:j.TEMPLATE_LABEL[e].title,selected:y===e,onPress:()=>w(e)},e))}),(0,k.jsx)(h.Muted,{children:j.TEMPLATE_LABEL[y].when}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Text message"}),(0,k.jsxs)(h.Muted,{children:[(0,j.smsParts)(N).chars," characters"]})]}),(0,k.jsx)(t.TextInput,{testID:"tpl-sms",accessibilityLabel:"Text message wording",multiline:!0,value:B.sms,onChangeText:e=>I({sms:e}),style:[h.styles.input,{minHeight:96,textAlignVertical:'top'}]}),(0,j.smsParts)(N).chars>300?(0,k.jsx)(h.T,{size:13,colour:f.colours.amber,children:"This is quite long. Under about 300 characters keeps it to two texts."}):null,(0,k.jsx)(h.T,{weight:"semibold",children:"Email subject"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Email subject",value:B.subject,onChangeText:e=>I({subject:e}),style:h.styles.input}),(0,k.jsx)(h.T,{weight:"semibold",children:"Email message"}),(0,k.jsx)(t.TextInput,{testID:"tpl-body",accessibilityLabel:"Email wording",multiline:!0,value:B.body,onChangeText:e=>I({body:e}),style:[h.styles.input,{minHeight:220,textAlignVertical:'top'}]}),(0,k.jsxs)(h.Row,{gap:6,style:{flexWrap:'wrap'},children:[p?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Make it warmer",testID:"tpl-warmer",onPress:()=>I(P(B))}):null,O?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Reset to our wording",onPress:()=>m.useStore.getState().setTemplate(e,y,null)}):null]}),p?(0,k.jsx)(h.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,k.jsxs)(h.Muted,{children:["Placeholders: ",j.PLACEHOLDERS.map(e=>`{${e.key}} ${e.what}`).join(' \xb7 ')]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Live preview"}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:"Text",selected:'sms'===A,onPress:()=>M('sms')}),(0,k.jsx)(h.Chip,{label:"Email",selected:'email'===A,onPress:()=>M('email')})]})]}),l.LIVE_VENUE_BUILD?(0,k.jsx)(h.Muted,{children:"Guest fields are filled only from a saved booking or order. This view contains no guest record."}):(0,k.jsxs)(h.Muted,{children:["Sample guest: Alex, ",'order'===y?'3 items, milk intolerance':'4 people tonight, peanut allergy, birthday note',"."]}),'sms'===A?(0,k.jsx)(C,{text:N,to:l.LIVE_VENUE_BUILD?void 0:"07700 900123"}):(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),_]}),(0,k.jsx)(v,{html:D})]})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Bookings that need confirming"}),(0,k.jsx)(h.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,k.jsx)(h.Stepper,{label:"Auto-accept online bookings up to",value:V.autoAcceptUpTo??7,min:1,max:30,onChange:s=>m.useStore.getState().updateSettings(e,{autoAcceptUpTo:s})}),(0,k.jsx)(h.Toggle,{label:"Also check online bookings with a special request",value:!!V.reviewRequests,onChange:s=>m.useStore.getState().updateSettings(e,{reviewRequests:s})})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Going live"}),(0,k.jsxs)(h.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,T.useCtx)(3e4),t=(0,m.useStore)(e=>e.outbox).filter(s=>s.restaurantId===e),[l,o]=(0,n.useState)('all'),[u,x]=(0,n.useState)(t.find(e=>'email'===e.channel)?.id??null),b=t.filter(e=>'all'===l||e.channel===l);return(0,k.jsxs)(c.default,{style:{gap:10},children:[(0,k.jsxs)(c.default,{testID:"outbox-banner",style:{backgroundColor:(0,s.soutersSurface)('#2a220f'),borderWidth:1,borderColor:f.colours.gold,borderRadius:12,padding:12},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:f.colours.gold,children:(0,j.isLive)()?'Live: messages are sent through your text and email service.':j.PREVIEW_BANNER}),(0,j.isLive)()?null:(0,k.jsx)(h.Muted,{children:"These are exactly the texts and emails your guests would get. Nobody has been sent anything."})]}),(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Chip,{label:`All (${t.length})`,selected:'all'===l,onPress:()=>o('all')}),(0,k.jsx)(h.Chip,{label:`Texts (${t.filter(e=>'sms'===e.channel).length})`,selected:'sms'===l,onPress:()=>o('sms')}),(0,k.jsx)(h.Chip,{label:`Emails (${t.filter(e=>'email'===e.channel).length})`,selected:'email'===l,onPress:()=>o('email')})]}),b.length?null:(0,k.jsx)(h.Muted,{children:"No messages yet. Make a booking or a takeaway order and its confirmation appears here."}),b.map(e=>(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(r.default,{accessibilityRole:"button",onPress:()=>x(u===e.id?null:e.id),style:{gap:4},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:6,children:[(0,k.jsx)(h.Badge,{kind:'sms'===e.channel?'blue':'gold',label:'sms'===e.channel?'Text':'Email'}),(0,k.jsxs)(h.T,{weight:"semibold",children:[A[e.kind]," \xb7 ",e.ref]})]}),(0,k.jsx)(h.Muted,{children:e.at.slice(11,16)})]}),(0,k.jsxs)(h.Muted,{children:["To ",e.toName,", ",e.to]}),(0,k.jsx)(h.T,{size:13,colour:'sent'===e.status?f.colours.ok:'failed'===e.status?f.colours.red:f.colours.amber,children:(0,j.statusLabel)(e)})]}),'sms'===e.channel?(0,k.jsx)(C,{text:e.body}):u===e.id?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsxs)(h.T,{size:14,children:[(0,k.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Subject: "}),e.subject]}),(0,k.jsx)(v,{html:e.html??'',height:560})]}):(0,k.jsxs)(h.Muted,{numberOfLines:1,children:["Subject: ",e.subject," (tap to preview)"]})]},e.id)),t.length?(0,k.jsx)(h.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])),h=_r(d[7]),u=_r(d[8]),m=_r(d[9]),x=_r(d[10]),b=_r(d[11]),j=_r(d[12]),p=_r(d[13]),y=_r(d[14]),f=_r(d[15]),w=_r(d[16]),T=_r(d[17]),k=_r(d[18]);function v({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 C({text:e,to:t}){const l=(0,j.smsParts)(e);return(0,k.jsxs)(c.default,{style:{gap:4},children:[t?(0,k.jsxs)(h.Muted,{children:["To ",t]}):null,(0,k.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,k.jsx)(h.T,{size:15,children:e})}),(0,k.jsxs)(h.Muted,{children:[l.chars," characters \xb7 ",l.parts," text",1===l.parts?'':'s',l.unicode?' (special characters make texts shorter)':'']})]})}const S={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},E={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 P(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 A={'booking-confirmation':'Booking confirmation','booking-request':'Request received','booking-declined':'Request declined','order-confirmation':'Takeaway order',test:'Test'}},1524,[813,812,822,17,219,385,85,777,1230,858,1521,1214,848,1232,1018,804,1027,1057,8]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.OnlineBookingRulesPage=function({go:e}){const{r:n,rid:g,role:h}=(0,k.useCtx)(6e4),p='owner'===h||'manager'===h,b=n.settings,x=(0,r.bookingRulesOf)(n),f=(0,o.usePlan)(g),j=(f?.areas??[]).map(e=>e.name),v=e=>{p&&l.useStore.getState().updateSettings(g,e)},T=e=>v({bookingRules:{...b.bookingRules??{},...x,...e}}),P=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t],S=(0,u.onlinePartyBounds)(n),M=(0,d.depositOf)(b),R=b.reservables??(0,i.reservablesOf)(n),O=(0,r.accessGuideOf)(n),[I,A]=(0,t.useState)(null),D=(e,t)=>T({largeGroups:x.largeGroups.map((n,s)=>s===e?{...n,...t}:n)});return(0,y.jsxs)(s.default,{style:{gap:10},testID:"online-booking-rules",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Preview",children:"These are the rules the online booking page follows. Changes are saved to your venue settings. Nothing is sent to guests from here."}),p?null:(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can change these."}),I?(0,y.jsx)(a.Muted,{center:!0,testID:"rules-msg",children:I}):null,(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:1,title:"Party size and dates"}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, from"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-min",value:S.min,min:1,max:S.max,onChange:e=>v({onlinePartyMin:e}),label:"online party from"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Online party size, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-party-max",value:S.max,min:S.min,max:100,onChange:e=>v({onlinePartyMax:e}),label:"online party up to"})]}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Taken without checking, up to"}),(0,y.jsx)(a.Stepper,{testID:"rules-auto",value:b.autoAcceptUpTo??7,min:1,max:30,onChange:e=>v({autoAcceptUpTo:e}),label:"auto-accept online bookings up to"})]}),(0,y.jsxs)(a.Muted,{center:!0,children:[(0,c.bookAheadUnlimited)(n)?'Full calendar: guests can pick any future date up to a year ahead.':`Guests can book up to ${(0,c.bookAheadDays)(n)} days ahead.`," Change this in Booking settings."]})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:2,title:"Large groups"}),(0,y.jsx)(a.Muted,{center:!0,children:"Groups in these sizes are placed on joined tables. Staff can still move them."}),x.largeGroups.map((e,t)=>(0,y.jsxs)(s.default,{style:{gap:4,alignItems:'center'},testID:`rules-group-${t}`,children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:(0,r.largeGroupLine)(e)}),(0,y.jsxs)(a.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Stepper,{value:e.from,min:1,max:e.to,onChange:e=>D(t,{from:e}),label:`group ${t+1} from`}),(0,y.jsx)(a.Stepper,{value:e.to,min:e.from,max:100,onChange:e=>D(t,{to:e}),label:`group ${t+1} up to`})]}),(0,y.jsx)(a.Field,{label:"Tables, joined (e.g. 14+15)",value:e.tables.join('+'),editable:p,onChangeText:e=>D(t,{tables:e.split(/[+,\s]+/).map(e=>e.trim()).filter(Boolean)})}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Remove this group size",onPress:()=>T({largeGroups:x.largeGroups.filter((e,n)=>n!==t)})}):null]},t)),x.largeGroups.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No large-group tables set."}),p?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add a group size",onPress:()=>{const e=x.largeGroups[x.largeGroups.length-1],t=e?e.to+1:8;T({largeGroups:[...x.largeGroups,{from:t,to:t+1,tables:[]}]})}}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:3,title:"Areas booked online"}),(0,y.jsx)(a.Muted,{center:!0,children:"Tap an area to stop online bookings there. Staff can still seat and book every area."}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>{const t=x.offlineAreas.some(t=>t.toLowerCase()===e.toLowerCase());return(0,y.jsx)(a.Chip,{testID:`rules-area-${e}`,label:e,sub:t?'Not online':'Online',selected:!t,disabled:!p,onPress:()=>T({offlineAreas:P(x.offlineAreas,e)})},e)})}),(0,y.jsx)(a.Field,{label:"Why (guests see this)",value:x.offlineReason,editable:p,onChangeText:e=>T({offlineReason:e})})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:4,title:"Dogs"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-dog-line",children:(0,r.dogRuleLine)(x,n.phone)}),(0,y.jsx)(a.T,{center:!0,size:14,children:"Pet dogs allowed in"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogAreas.includes(e),disabled:!p,onPress:()=>T({dogAreas:P(x.dogAreas,e)})},e))}),(0,y.jsx)(a.T,{center:!0,size:14,children:"On the day only, weather permitting"}),(0,y.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:j.map(e=>(0,y.jsx)(a.Chip,{label:e,selected:x.dogWeatherAreas.includes(e),disabled:!p,onPress:()=>T({dogWeatherAreas:P(x.dogWeatherAreas,e)})},e))}),(0,y.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(a.T,{children:"Most people online with a dog"}),(0,y.jsx)(a.Stepper,{testID:"rules-dog-max",value:x.dogMaxParty,min:0,max:20,format:e=>e?String(e):'No limit',onChange:e=>T({dogMaxParty:e}),label:"most people online with a dog"})]}),(0,y.jsx)(a.Muted,{center:!0,children:"Assistance dogs are always welcome anywhere and never count towards this."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:5,title:"Requested table"}),(0,y.jsx)(a.Toggle,{label:"Guests can request a table",value:!1!==b.tableRequests,disabled:!p,onChange:e=>v({tableRequests:e})}),(0,y.jsx)(a.Field,{label:"What guests are told",value:x.tableRequestNote,editable:p,onChangeText:e=>T({tableRequestNote:e}),multiline:!0}),x.tableRequestNote!==r.TABLE_REQUEST_NOTE&&p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Back to the usual words",onPress:()=>T({tableRequestNote:r.TABLE_REQUEST_NOTE})}):null,x.onlineTableMins.map((e,t)=>(0,y.jsxs)(a.Muted,{center:!0,testID:`rules-table-min-${t}`,children:[(0,r.onlineTableMinLine)(e),". Staff can still book them for fewer."]},t)),(0,y.jsx)(a.Muted,{center:!0,children:"Requests show in gold on the booking in Managers, the Display and the kitchen."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:6,title:"Access needs"}),(0,y.jsx)(a.Muted,{center:!0,children:"Shown when a guest asks for step-free access, has a wheelchair user or brings an assistance dog. The booking is flagged \u267f for staff."}),(0,y.jsx)(a.Field,{label:"Step-free entry guide",value:b.accessStatement??O,editable:p,multiline:!0,onChangeText:e=>v({accessStatement:e}),testID:"rules-access"})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:7,title:"Deposits and pre-orders"}),(0,y.jsx)(a.Muted,{center:!0,testID:"rules-deposit-line",children:M.on&&M.perPersonPence>0?`${w(M.perPersonPence)} per adult for ${M.fromParty} or more adults. Children don't count and don't pay. Staff can waive it for regulars.`:'Group deposits are off.'}),R.filter(e=>e.active).map(e=>(0,y.jsxs)(a.Muted,{center:!0,children:[e.name,e.serves&&!/\(serves/i.test(e.name)?` (serves ${2===e.serves?'two':e.serves})`:'',", ",w(e.price),": ",e.payOnNight||!e.depositPence?'no deposit, paid on the night':`${w(e.depositPence)} deposit per item, through website bookings`]},e.id)),(0,y.jsx)(a.Muted,{center:!0,children:"Pre-orders and deposits show on the booking for staff and the kitchen."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Change amounts in Advanced settings",onPress:()=>e('more','advanced')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:8,title:"Email and marketing"}),(0,y.jsx)(a.Toggle,{label:"Email needed to book or order online",value:x.emailRequiredOnline,disabled:!p,onChange:e=>T({emailRequiredOnline:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"Online pages only. Bookings made by staff, walk-ins and the Display keep email optional."}),(0,y.jsx)(a.Toggle,{label:"Offer the marketing tick (always unticked to start)",value:x.marketingOptIn,disabled:!p,onChange:e=>T({marketingOptIn:e})}),(0,y.jsx)(a.Field,{label:"Marketing tick words",value:x.marketingWords,editable:p,onChangeText:e=>T({marketingWords:e}),multiline:!0}),(0,y.jsx)(a.Muted,{center:!0,children:"Only guests who ticked it can be sent marketing (UK GDPR and PECR)."}),e?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Marketing opt-ins \u203a",onPress:()=>e('more','optins')}):null]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:9,title:"Allergies"}),(0,y.jsx)(a.Toggle,{label:"Guests tick to confirm the allergy information",value:x.allergyConfirm,disabled:!p,onChange:e=>T({allergyConfirm:e})}),(0,y.jsx)(a.Field,{label:"Tick words",value:x.allergyConfirmWords,editable:p,onChangeText:e=>T({allergyConfirmWords:e})}),(0,y.jsx)(a.Muted,{center:!0,children:"The allergy question always comes first, and staff see the guest's answer and tick on every booking."})]}),(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(C,{n:10,title:"Notes example"}),(0,y.jsx)(a.Field,{label:"Shown in the empty notes box",value:x.notesPlaceholder,editable:p,onChangeText:e=>T({notesPlaceholder:e}),testID:"rules-notes"})]}),p?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Put every rule back to the defaults",onPress:()=>{v({bookingRules:void 0}),A('Online booking rules are back to the defaults.')}}):null]})},_e.supervisorNow=v,Object.defineProperty(_e,"optinsAllowed",{enumerable:!0,get:function(){return T}}),_e.MarketingOptInsPage=function(){const{rid:e,role:n}=(0,k.useCtx)(6e4),o=T(n),i=(0,l.useBookings)(e),d=(0,l.useOrders)(e),u=(0,b.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[c,h]=(0,t.useState)(null),[p,w]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!o||!u||!(0,f.isSupabaseConfigured)())return;let e=!0;try{(0,x.getSupabase)().rpc('marketing_optins',{p_venue:u}).then(({data:t,error:n})=>{e&&!n&&Array.isArray(t)&&h(t.map(e=>({email:e.email,name:e.name,optedInAt:e.opted_in_at,lastBooking:e.last_booking??'',bookings:e.bookings??0,source:e.source??''})))},()=>{})}catch{}return()=>{e=!1}},[o,u]);const C=(0,t.useMemo)(()=>(0,r.optedInGuests)([...i,...d.map(e=>({email:e.email,name:e.customerName,date:e.createdAt.slice(0,10),source:'takeaway',marketingOptIn:e.marketingOptIn,marketingOptInAt:e.marketingOptInAt}))]),[i,d]);if(!o)return(0,y.jsx)(a.Muted,{center:!0,children:"Only managers and owners can see the marketing list."});const v=c??C,P=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?'':t.toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',year:'numeric'})};return(0,y.jsxs)(s.default,{style:{gap:10},testID:"marketing-optins",children:[(0,y.jsx)(a.Banner,{kind:"demo",title:"Nothing is sent",children:"This is the list of guests who ticked the marketing box. CoverCharge doesn't send marketing. Download the list for your own mail tool."}),(0,y.jsx)(a.Muted,{center:!0,children:"Only these guests may be sent news and offers (UK GDPR and PECR). If a guest later books with the box left unticked, they come off the list."}),(0,y.jsxs)(a.Row,{gap:6,style:{justifyContent:'center'},children:[(0,y.jsx)(a.Badge,{kind:"gold",label:`${v.length} opted in`}),(0,y.jsx)(a.Badge,{kind:"neutral",label:c?'From the server':'From this device'})]}),v.map(e=>(0,y.jsxs)(a.Card,{children:[(0,y.jsx)(a.T,{weight:"semibold",center:!0,children:e.name||'Guest'}),(0,y.jsx)(a.Muted,{center:!0,children:e.email}),(0,y.jsxs)(a.Muted,{center:!0,size:13,children:["Opted in ",P(e.optedInAt),e.bookings?` \xb7 ${e.bookings} booking${1===e.bookings?'':'s'}`:'',e.lastBooking?` \xb7 last ${e.lastBooking.split('-').reverse().join('/')}`:'']}),c&&u&&(0,f.isSupabaseConfigured)()?(0,y.jsx)(a.Button,{small:!0,kind:"ghost",label:"Guest unsubscribed: take off the list",accessibilityLabel:`${e.name||'Guest'} unsubscribed: take off the marketing list`,onPress:()=>{(0,x.getSupabase)().rpc('marketing_optout',{p_venue:u,p_email:e.email}).then(({error:t})=>{t?w('That did not save. Try again.'):(h(t=>(t??[]).filter(t=>t.email!==e.email)),w(`${e.email} is off the list.`))},()=>w('That did not save. Try again.'))}}):null]},e.email)),v.length?null:(0,y.jsx)(a.Muted,{center:!0,children:"No one has opted in yet."}),v.length?(0,y.jsx)(a.Button,{small:!0,kind:"secondary",label:"Download CSV",testID:"optins-csv",onPress:()=>{(0,g.downloadText)('marketing-opt-ins.csv',(0,r.optedInCsv)(v)),w('CSV downloaded. Keep it private.')}}):null,p?(0,y.jsx)(a.Muted,{center:!0,children:p}):null,(0,y.jsx)(a.T,{size:13,colour:j.colours.muted,center:!0,children:"Every email you send must include an easy way to unsubscribe."})]})};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]),o=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),g=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),j=_r(_d[16]),k=_r(_d[17]),y=_r(_d[18]);const w=e=>`\xa3${(e/100).toFixed(e%100?2:0)}`,C=({n:e,title:t})=>(0,y.jsxs)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:[e,". ",t]});function v(){if('supervisor'===String(b.useSync.getState().role||''))return!0;const e=p.useSession.getState().meId;return!!e&&h.useOwner.getState().staff.some(t=>t.id===e&&'Supervisor'===t.level)}const T=e=>('owner'===e||'manager'===e)&&!v()},1525,[17,85,777,858,998,1079,1055,841,1105,1252,889,876,920,899,928,971,804,1057,8]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OrderSheetSettings=function(){const e=(0,o.useOwner)(e=>e.site),u=(0,i.useSheets)(e),[p,m]=(0,t.useState)(null);return p?(0,c.jsxs)(s.Card,{children:[(0,c.jsx)(s.T,{weight:"semibold",children:u.some(e=>e.id===p.id)?`Edit ${p.name}`:'New supplier'}),(0,c.jsx)(b,{rid:e,s:p,onDone:()=>m(null)})]}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"order-sheet-settings",children:[(0,c.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,c.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${e.name}`,onPress:()=>m(e),children:(0,c.jsxs)(s.Card,{children:[(0,c.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(s.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,c.jsx)(s.Badge,{kind:e.placeholder?'amber':'gold',label:e.placeholder?'To fill in':h.METHOD_LABEL[e.method]})]}),(0,c.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,c.jsx)(s.Muted,{children:"Number not added yet"}),'online'!==e.method||e.url?null:(0,c.jsx)(s.Muted,{children:"Link not added yet"})]})},e.id)),(0,c.jsx)(s.Row,{wrap:!0,gap:8,children:(0,c.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 t=r(_d[0]),l=e(r(_d[1])),n=e(r(_d[2])),s=r(_d[3]),o=r(_d[4]),i=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),p=r(_d[9]),c=r(_d[10]);const m=['online','phone','text','whatsapp','tbc'];function x({label:e,value:t,onChange:l}){return(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:e}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:h.DAY3.map((e,n)=>(0,c.jsx)(s.Chip,{label:e,selected:t.includes(n),onPress:()=>l(t.includes(n)?t.filter(e=>e!==n):[...t,n].sort())},e))})]})}function b({rid:e,s:l,onDone:o}){const d=(0,i.useOrderSheets)(e=>e.upsert),b=(0,i.useOrderSheets)(e=>e.remove),[y,f]=(0,t.useState)(l),[j,C]=(0,t.useState)(l.items.map(e=>`${e.name}${e.unit?` | ${e.unit}`:''}`).join('\n')),[v,w]=(0,t.useState)(l.priceCapPerKg?(l.priceCapPerKg/100).toFixed(2):''),[T,D]=(0,t.useState)(!1),P=e=>f(t=>({...t,...e}));return(0,c.jsxs)(n.default,{testID:"sheet-editor",style:{gap:10,width:'100%',minWidth:0,maxWidth:'100%'},children:[(0,c.jsx)(s.Field,{label:"Supplier name",value:y.name,onChangeText:e=>P({name:e})}),(0,c.jsx)(s.Field,{label:"What they supply",value:y.goods,onChangeText:e=>P({goods:e})}),(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(s.T,{size:14,weight:"medium",colour:u.colours.muted,children:"How to order"}),(0,c.jsx)(s.Row,{wrap:!0,gap:6,children:m.map(e=>(0,c.jsx)(s.Chip,{label:h.METHOD_LABEL[e],selected:y.method===e,onPress:()=>P({method:e})},e))})]}),'text'===y.method||'whatsapp'===y.method||'phone'===y.method?(0,c.jsx)(s.Field,{label:"Number (can be left blank for the chef to fill in)",value:y.number,keyboardType:"phone-pad",onChangeText:e=>P({number:e})}):null,'online'===y.method?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.Field,{label:"Ordering website link (can be left blank)",value:y.url,autoCapitalize:"none",keyboardType:"url",onChangeText:e=>P({url:e.trim()})}),(0,c.jsx)(s.Field,{label:"Button label",value:y.urlLabel??'',placeholder:"Open website",onChangeText:e=>P({urlLabel:e})})]}):null,(0,c.jsx)(s.Field,{label:"Contact first name for the message (optional)",value:y.contact??'',onChangeText:e=>P({contact:e})}),(0,c.jsx)(x,{label:"Delivery days",value:y.deliveryDays,onChange:e=>P({deliveryDays:e})}),(0,c.jsx)(x,{label:"Order days (a reminder shows in the Head Chef app)",value:y.orderDays,onChange:e=>P({orderDays:e})}),(0,c.jsxs)(s.Row,{gap:10,children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{label:"Cut-off (HH:MM, optional)",value:y.cutoff,placeholder:"e.g. 14:00",onChangeText:e=>P({cutoff:e})})}),(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(s.Field,{money:!0,label:"Price cap \xa3/kg (optional)",value:v,keyboardType:"decimal-pad",onChangeText:w})})]}),(0,c.jsx)(s.Field,{label:"Reminder text (optional)",value:y.reminder,onChangeText:e=>P({reminder:e})}),(0,c.jsx)(s.Field,{label:"How often (e.g. Weekly or fortnightly)",value:y.frequency,onChangeText:e=>P({frequency:e})}),y.priceCapPerKg||v?(0,c.jsx)(s.Field,{label:"Seller",value:y.seller,onChangeText:e=>P({seller:e})}):null,(0,c.jsx)(s.Field,{label:"Items, one per line (name | unit)",value:j,multiline:!0,style:{minHeight:90},onChangeText:C}),(0,c.jsx)(s.Field,{label:"Notes for the chef",value:y.notes,multiline:!0,onChangeText:e=>P({notes:e})}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Save supplier",testID:"sheet-save",onPress:()=>{const t=j.split('\n').map(e=>e.trim()).filter(Boolean).map((e,t)=>{const[n,s]=e.split('|').map(e=>e.trim()),o=l.items.find(e=>e.name===n);return{id:o?.id??`${y.id}-i${t}-${Date.now().toString(36)}`,name:n,unit:s??''}}),n=Math.round(100*((0,p.parseMoneyInput)(v)??NaN));d(e,{...y,items:t,priceCapPerKg:n>0?n:0,placeholder:y.placeholder&&'tbc'===y.method}),o()},disabled:!y.name.trim()}),(0,c.jsx)(s.Button,{kind:"ghost",label:"Cancel",onPress:o}),T?(0,c.jsx)(s.Button,{kind:"danger",label:"Yes, remove",onPress:()=>{b(e,l.id),o()}}):(0,c.jsx)(s.Button,{kind:"ghost",label:"Remove from list",onPress:()=>D(!0)})]})]})}},1526,[17,385,85,777,876,1000,851,1001,804,840,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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]})}},1527,[17,219,385,85,409,777,804,1379,857,1383,863,899,1384,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1528,[820,896,1457,17,219,85,777,816,876,895,1000,897,899,1529,804,880,1163,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1529,[]); +__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])},1530,[17,85,777,804,1436,1512,1057,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.showMe=w,_e.HelpPage=function({go:e}){const[s,o]=(0,a.useState)(''),[r,h]=(0,a.useState)(null),[p,x]=(0,a.useState)(null),w=(0,a.useMemo)(()=>[...c.HELP,...m],[]),j=(0,a.useMemo)(()=>s.trim()?(0,u.searchHelp)(w,s,10).map(e=>e.a):w.filter(e=>!r||e.topic===r),[s,r,w]);return(0,f.jsxs)(i.default,{style:{gap:10},testID:"help-page",children:[(0,f.jsxs)(i.default,{style:[l.styles.input,{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:4}],children:[(0,f.jsx)(l.T,{colour:y.colours.muted,children:"\ud83d\udd0d"}),(0,f.jsx)(t.TextInput,{testID:"help-search",value:s,onChangeText:o,placeholder:"Search help",placeholderTextColor:"#7D776C",accessibilityLabel:"Search help",style:{flex:1,minWidth:0,width:0,boxSizing:'border-box',color:y.colours.text,paddingVertical:8,fontSize:16,outlineStyle:'none'}}),s?(0,f.jsx)(n.GoldClose,{testID:"help-search-clear",size:"sm",label:"Clear search",onPress:()=>o('')}):null]}),s?(0,f.jsx)(l.Muted,{children:j.length?`${j.length} result${1===j.length?'':'s'} for \u201c${s.trim()}\u201d`:`Nothing for \u201c${s.trim()}\u201d. Try other words, or ask the Assistant above.`}):(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:[null,...c.HELP_TOPICS].map(e=>(0,f.jsx)(l.Chip,{label:e??'All',selected:r===e,onPress:()=>h(e)},e??'all'))}),j.map((t,n)=>(0,f.jsx)(b,{a:t,go:e,open:p===t.id||!!s&&0===n&&null===p,onToggle:()=>x(p===t.id?'':t.id)},t.id)),(0,f.jsxs)(l.Card,{style:{alignItems:'center'},children:[(0,f.jsx)(l.T,{center:!0,weight:"semibold",colour:y.colours.gold,children:"Chat with CoverCharge support"}),(0,f.jsx)(l.Muted,{center:!0,children:"Send a message to the CoverCharge team. Nobody replies automatically."}),(0,f.jsx)(l.Button,{label:"Open the chat",accessibilityLabel:"Open the chat with CoverCharge support",onPress:()=>e('more','support')})]})]})},_e.AskAssistant=function({go:e}){const{rid:t,today:s}=(0,x.useCtx)(6e4),n={rid:t,today:s,go:(t,s)=>e(t,s??null)},[o,r]=(0,a.useState)(''),[h,u]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),C=async()=>{const e=o.trim();if(!e)return;b(null),u(null);const t=(0,p.matchIntent)(e,s);if('action'!==t.kind)'help'!==t.kind?b({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'}):b({text:'Here\u2019s what I found. Tap Show me and I\u2019ll point to it.',kind:'note',help:t.ids});else{if(!(0,p.needsConfirm)(t.action.risk)){const e=await(0,p.runAction)(t.action.id,t.params,n);return void b({text:'done'===e.status?e.message:e.message??'',kind:'done'})}u({action:t.action,params:{...j(t.action,s),...t.params},asked:e})}};return(0,f.jsx)(i.default,{testID:"ask-assistant",children:(0,f.jsxs)(l.Card,{highlight:y.colours.gold,children:[(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(i.default,{style:{width:28,height:28,borderRadius:14,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{weight:"bold",colour:"#1A1408",children:"\u2726"})}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:"Ask the Assistant"})]}),(0,f.jsxs)(i.default,{testID:"help-assistant-stack",style:{gap:8,width:'100%',minWidth:0},children:[(0,f.jsx)(l.Field,{label:"Ask or tell it what to do",testID:"assistant-input",value:o,onChangeText:r,placeholder:"Ask in plain words",onSubmitEditing:C,returnKeyType:"send",style:{width:'100%',minWidth:0,boxSizing:'border-box'}}),(0,f.jsx)(l.Button,{label:"Ask",testID:"assistant-ask",disabled:!o.trim(),onPress:C,style:{width:'100%',minWidth:0,minHeight:52}})]}),(0,f.jsx)(l.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,f.jsx)(l.Chip,{label:e,onPress:()=>r(e)},e))}),h?(0,f.jsx)(k,{p:h,today:s,onChange:e=>u({...h,params:e}),onConfirm:async()=>{if(!h)return;const e=await(0,p.runAction)(h.action.id,h.params,n,!0);u(null),r(''),b('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:()=>{u(null),b({text:'Cancelled. Nothing was changed.',kind:'note'})}}):null,m?(0,f.jsxs)(i.default,{style:{gap:6},testID:"assistant-reply",children:[(0,f.jsx)(l.Banner,{kind:'done'===m.kind?'success':'error'===m.kind?'warn':'demo'===m.kind?'demo':'info',title:m.text}),m.help?.map(t=>{const s=(0,c.helpById)(t);return(0,f.jsxs)(l.Row,{gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{style:{flex:1},children:s.title}),s.showMe?(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",onPress:()=>w(s,e)}):null]},t)})]}):null,(0,f.jsx)(l.Muted,{size:12,children:"It shows you what it will do and waits for your tap. It never sends, pays or deletes anything."})]})})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),o=e(_r(d[4])),i=e(_r(d[5])),l=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),p=_r(d[11]),y=_r(d[12]),x=_r(d[13]),f=_r(d[14]);const m=[{id:'ai-assistant-pairing',kind:'faq',topic:'Accounts',title:'Can I connect my own AI assistant?',keywords:['assistant','ai','pair','pairing','grok','bot','unpair','approve','draft','log'],body:'AI assistant ready: connect your own AI assistant, such as Grok Bot, to your owner app. In the connected assistant, it can answer questions about your venue and give advice from the venue data it is allowed to look up. It can draft changes for you to approve, and change your settings once you approve (except plan and billing, staff sign-in links, PINs, the kitchen unlock code, and connected accounts). You can switch it off at any time, and everything it does is logged, including look-ups. Open More \u203a Account \u203a Assistants, as an owner, on Full Restaurant Pro, SuperPro or the early adopter offer. It is not included with Customer & Takeaway App, and there is no AI assistant on the Display app.',showMe:{tab:'more',page:'assistants',target:{testID:'assistants-page'},hint:'Pair, switch off or unpair an assistant here. Owners only.'}},{id:'customer-support',kind:'faq',topic:'Accounts',title:'How do I contact CoverCharge support?',keywords:['support','customer support','help','email','picture','photo','screenshot','contact','covercharge'],body:'Customer support is at the very bottom of Home, and at the bottom of More, as an owner. Write a message, attach one picture if you like (a photo or a screenshot), and tap Send to CoverCharge. It is sent with your venue name, your name and email, and the app version. You will see \u201cSent. We\u2019ll reply by email.\u201d if it went through, or an error with a way to try again. There is no Customer support on the Display, Staff, Front of House or Head Chef apps.',showMe:{tab:'more',page:'support',target:{testID:'customer-support'},hint:'Write a message, attach a picture if you like, and send it to CoverCharge. Owners only.'}},{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:'In the Managers app go to More \u203a Run the day \u203a Display settings 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. There is no wipe or unpair button on the Display itself. To switch a Display off, go to Settings \u203a Displays and choose Switch off.',showMe:{tab:'more',page:'displaysettings',target:{testID:'wipe-setting'},hint:'Sign out and wipe is in Display settings, in the Managers app only.'}}];function w(e,t){e.showMe&&(t(e.showMe.tab,e.showMe.page??null),setTimeout(()=>h.useCoach.getState().show(e.showMe.target,e.showMe.hint),300))}function b({a:e,go:t,open:s,onToggle:n}){return(0,f.jsx)(i.default,{testID:`help-${e.id}`,children:(0,f.jsxs)(l.Card,{children:[(0,f.jsx)(o.default,{accessibilityRole:"button",onPress:n,children:(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},gap:8,children:[(0,f.jsxs)(i.default,{style:{flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.title}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:'guide'===e.kind?'gold':'neutral',label:'guide'===e.kind?'Step by step':'FAQ'}),(0,f.jsx)(l.Muted,{size:12,children:e.topic})]})]}),(0,f.jsx)(l.T,{colour:y.colours.muted,children:s?'\u25be':'\u203a'})]})}),s?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{children:e.body}),e.steps?.map((e,t)=>(0,f.jsxs)(l.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,f.jsx)(i.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,f.jsx)(l.T,{size:12,weight:"bold",colour:"#1A1408",children:t+1})}),(0,f.jsx)(l.T,{style:{flex:1},children:e})]},t))]}):null,e.showMe?(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:(0,f.jsx)(l.Button,{small:!0,kind:"success",label:"Show me",testID:`showme-${e.id}`,onPress:()=>w(e,t)})}):null]})})}function j(e,t){return'add_rota_shift'===e.id?{date:t,start:17,end:23}:'add_walkin'===e.id?{covers:2}:{}}function k({p:e,today:t,onChange:n,onConfirm:a,onCancel:o}){const h=(0,r.useOwner)(e=>e.staff).filter(e=>e.active),c=(0,p.demoOnly)(e.action.risk),u=(t,s)=>n({...e.params,[t]:s}),x=e.action,m=e.params,w=x.params.every(e=>!e.required||void 0!==m[e.name]&&''!==m[e.name]);return(0,f.jsxs)(i.default,{testID:"assistant-confirm",style:{borderWidth:2,borderColor:c?y.colours.red:y.colours.ok,borderRadius:14,padding:12,gap:8,backgroundColor:c?'#2a1010':y.colours.okBg},children:[(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(l.Badge,{kind:c?'red':'ok',label:p.RISK_LABEL[x.risk]}),(0,f.jsx)(l.T,{weight:"semibold",style:{flex:1},children:x.title})]}),x.form&&'add_walkin'===x.id?(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Covers",value:void 0===m.covers?'':String(m.covers),onChangeText:e=>u('covers',e.replace(/\D/g,'')?Number(e.replace(/\D/g,'')):void 0),keyboardType:"number-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Table (optional)",value:void 0===m.table?'':String(m.table),onChangeText:e=>u('table',e.trim()?e.trim().toUpperCase():void 0)})})]}):null,x.form&&'add_rota_shift'===x.id?(0,f.jsxs)(i.default,{style:{gap:6},children:[(0,f.jsx)(l.Muted,{size:12,children:"Who"}),(0,f.jsx)(l.Row,{wrap:!0,gap:6,children:h.slice(0,14).map(e=>(0,f.jsx)(l.Chip,{label:e.name.replace(' (example)','').split(' ')[0],selected:m.staffId===e.id,onPress:()=>u('staffId',e.id)},e.id))}),(0,f.jsxs)(l.Row,{gap:6,children:[(0,f.jsx)(i.default,{style:{flex:1.3},children:(0,f.jsx)(l.Field,{label:"Date (DD/MM/YYYY)",...(0,s.slashBox)(String(m.date??t),e=>u('date',e)),placeholder:"20/11/2026",keyboardType:"numbers-and-punctuation",maxLength:10})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"Start (24h)",value:String(m.start??''),onChangeText:e=>u('start',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})}),(0,f.jsx)(i.default,{style:{flex:1},children:(0,f.jsx)(l.Field,{label:"End (24h)",value:String(m.end??''),onChangeText:e=>u('end',''===e?void 0:Number(e)),keyboardType:"decimal-pad"})})]})]}):null,(0,f.jsx)(l.T,{children:w?x.preview(m,{rid:'',today:t,go:()=>{}}):'Fill in the missing details above.'}),c?(0,f.jsx)(l.Muted,{children:"This Assistant does not send, pay or delete. Confirm only shows what would happen."}):(0,f.jsx)(l.Muted,{children:"Nothing happens until you tap Confirm."}),(0,f.jsxs)(l.Row,{gap:8,children:[(0,f.jsx)(l.Button,{kind:c?'danger':'success',label:c?'Confirm (nothing is sent)':'Confirm',testID:"assistant-confirm-yes",disabled:!w,onPress:a,style:{flex:1}}),(0,f.jsx)(l.Button,{kind:"ghost",label:"Cancel",onPress:o,style:{flex:1}})]})]})}},1531,[812,1033,779,17,385,85,777,876,1482,1532,1533,1534,804,1057,8]); +__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 a}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return o}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],a=[{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.','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 your suppliers',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add supplier links for this venue, with an 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 against a supplier (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:'display-every-plan',kind:'faq',topic:'Settings',title:'Which plans include the customer app?',keywords:['customer app','guest app','download','phone','plan','package','superpro','epos','early adopter'],body:'The downloadable customer app for guests\u2019 phones comes with every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. SuperPro is everything in Pro, plus EPOS (tills, kitchen displays and waiter pads) and a full venue app for staff and customers. 1-year contract. Once your EPOS is connected, everything works together as one system, giving you insights on live sales and takings, GP changes and every edited clock-in. The early adopter offer (first 50 venues) is every Full Restaurant Pro feature: one-month free trial, then a 12-month contract at \xa349 a month + VAT if applicable, per venue, then rolling monthly at \xa399 with one month\u2019s notice. Every plan has free customer support for the length of your subscription and free over-the-air updates. All prices + VAT if applicable, per venue.'},{id:'ota-free',kind:'faq',topic:'Settings',title:'Do app updates cost extra?',keywords:['update','updates','over-the-air','ota','new version','upgrade','cost','free','plan'],body:'Free over-the-air updates, on every plan: Customer & Takeaway App, Full Restaurant Pro App, SuperPro and the early adopter offer. Over-the-air updates will be available free of charge to the app.'},{id:'owner-desktop-plan',kind:'faq',topic:'Settings',title:'Which plans include the owner desktop version?',keywords:['desktop','computer','mac','pc','owner desktop','ecosystem','plan','package','superpro','early adopter'],body:'The owner desktop version \u2014 the complete ecosystem on Mac or PC \u2014 comes with Full Restaurant Pro App, SuperPro and the early adopter offer. It is not included with Customer & Takeaway App. It is an installable wide-screen web app that uses the same data, sign-ins and permissions as the phone app. Open it from the CoverCharge website\u2019s /desktop page, or from More \u203a Use on a computer on your phone. On SuperPro it comes with full ecosystem insights once your EPOS is connected: insights on live sales and takings, GP changes and every edited clock-in.'},{id:'confirm-by-email',kind:'faq',topic:'Bookings',title:'How are bookings and takeaway orders confirmed?',keywords:['confirmation','confirm','email','text','sms','booking','takeaway','wix'],body:'CoverCharge confirms guest bookings and takeaway orders by email. CoverCharge itself does not confirm by text. If a booking was made through the website, the website may also text the guest its own confirmation. That isn\u2019t CoverCharge.'},{id:'guest-change-link',kind:'faq',topic:'Bookings',title:'Can guests change or cancel their own booking?',keywords:['change','cancel','link','email','guest','move','booking'],body:'Yes. The confirmation email has a "Change or cancel your booking" link for that one booking, with "Or call us on (your number) and quote your booking details." underneath. Guests can change the date, time or party size within your online booking rules, or cancel after confirming. Bookings with a deposit say "please call us" instead. Takeaway orders can\u2019t be changed or cancelled by the guest, and their email has no link. You see every change on the Display and in Managers, marked as changed by the guest. The link stops working at the booking time.'},{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 the length of your subscription. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{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:'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 Deluxe Seafood Platter (serves two) (1 crab + 1 lobster, \xa3165, \xa325 deposit per platter) 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 takings \xf7 Covers, by day and by week. Takings are card + cash \u2212 card tips from the cash up, worked out for you (a prepaid function with no card or cash uses its Gross). 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:'Enter the cash up, or upload a spreadsheet',keywords:['cash up','paid out','spreadsheet','csv','excel','xlsx','sheet','gross','card','cash','tips','takings','drawer'],body:'In Cash up & sales tap Enter the cash up and type the figures (Z total, card, cash, paid outs, tips, and gross if you have it). In Paid out, add a line for each amount taken from the till \u2014 for example lobsters or supermarket shopping \u2014 with the amount, an optional note, and your name. The paid-out total comes off the expected cash in the drawer. Check every figure, 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. You can export cash ups as a spreadsheet from Recent cash ups.',showMe:{tab:'more',page:'cashup',target:{testID:'cashup-by-hand'},hint:'Start the cash up 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 has a Gift vouchers button: it opens the list of website vouchers (search, use by dates, Mark as used), with Show the buy QR code at the bottom. Guests buy on your website.',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','per adult','children','waive','waived','regular','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per adult (children never pay and do not count towards the number that needs one: a table of 8 with 3 children pays nothing; a table of 6 adults, or 7 with 1 child, pays for 6), the smallest number of adults that pays one (6 or more adults at The Anchorage), whether it is refundable and up to how many hours before, and the words guests see. Staff can waive a deposit. 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.','To let a regular off, tap Waive deposit on the booking (or in Edit booking), add why if you like, and tap Yes, waive it. Your name is saved with it.']},{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 Enter the cash up. Type each figure; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Add any cash paid out of the till (lobsters, supermarket shopping, and the like) in the Paid out section: each line has what it was for, the amount, an optional note and who entered it. The total reduces the expected cash in the drawer. 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 if they are allowed to see takings. 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:'cashup-by-hand'},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.'},{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.'}],o=t=>a.find(a=>a.id===t)},1532,[]); +__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}},1533,[]); +__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}},1534,[1535,1100,843,1536,1537,876,858,998,1482,1532,1533,1539,1538,1541,1542,996,997]); +__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))}}]},1535,[1064,1063,1023]); +__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 v}}),Object.defineProperty(e,"appNow",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"num",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"tableIn",{enumerable:!0,get:function(){return A}}),e.resolveTable=x,Object.defineProperty(e,"tokensOf",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return E}}),e.findBooking=P,Object.defineProperty(e,"staffOf",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"findCard",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"OPS_VOICE_ACTIONS",{enumerable:!0,get:function(){return $e}});var t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),r=_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]),h=_r(_d[12]),p=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),k=_r(_d[17]),w=_r(_d[18]);const v=t=>{const[n,a,r]=t.split('-').map(Number);return new Date(n,a-1,r).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},S=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},$=(t,n)=>n.test(t),C=t=>t.who??('display'===t.app?'Display':'Assistant');function N(t){if('display'===t.app)return!0;if((0,d.isKitchenViaDisplay)())return!0;const n=m.useOwner.getState().staff.find(n=>n.id===t.whoId);return(0,o.canSeatClearFinish)({role:n?.role??t.role,ownerAccess:n?.ownerAccess,managerAccess:n?.managerAccess})}const I={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},L=t=>null==t||''===t?void 0:'number'==typeof t?t:I[String(t).toLowerCase()]??(Number.isFinite(Number(t))?Number(t):void 0),_=['owner','staff','display'],q=['owner','staff','chef','display'],O=['staff'],D=/\btables?\s+([a-z]?\d{1,3}[a-z]?|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/i,A=t=>{const n=t.match(D);return n?String(L(n[1])??n[1]).toUpperCase():void 0};function x(t,n){const a=String(n??'').replace(/^tables?\s+/i,'').trim();if(!a)return;const r=String(L(a)??a).toLowerCase(),o=(0,u.planOf)(t),i=[...new Set([...(o?.tables??[]).map(t=>t.name),...Object.keys(u.useFloor.getState().live[t]??{})])];return i.find(t=>t.toLowerCase()===r)??(o?.tables??[]).find(t=>(t.label??'').toLowerCase()===r)?.name??i.find(t=>t.toLowerCase().replace(/[^0-9a-z]/g,'').replace(/^t(?=\d)/,'')===r.replace(/[^0-9a-z]/g,''))}const T=(t,n)=>u.useFloor.getState().live[t]?.[n]??{},j=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']),M=t=>t.toLowerCase().replace(/[^a-z0-9: ]/g,' ').split(/\s+/).filter(t=>t.length>2&&!j.has(t)),E=t=>{const n=t.match(/\b(\d{1,2})(?:[:.](\d{2}))?\s*(am|pm)?\b/i);if(!n)return null;let a=Number(n[1]);return'pm'===n[3]?.toLowerCase()&&a<12&&(a+=12),!n[3]&&a>=1&&a<=11&&(a+=12),`${String(a).padStart(2,'0')}:${n[2]??'00'}`};function P(t,n,a,r,o){const i=String(a??'').toLowerCase(),s=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status)&&!/walk-?in/i.test(a.name??'')),d=c.useStore.getState().bookings.filter(a=>a.restaurantId===t&&a.date===n&&r.includes(a.status));if(!i&&!o)return;const l=d.find(t=>t.ref&&i.includes(t.ref.toLowerCase()));if(l)return l;const b=M(i),h=s.filter(t=>M(t.name).some(t=>b.includes(t)));if(1===h.length)return h[0];if(o){const t=d.filter(t=>(0,u.tablesOf)(t.table).some(t=>t.toLowerCase()===o.toLowerCase())),n=h.length?t.filter(t=>h.includes(t)):t;if(n.length)return n.sort((t,n)=>('seated'===t.status?-1:1)-('seated'===n.status?-1:1))[0]}const p=/\d/.test(i.replace(D,''))?E(i.replace(D,'')):null;if(p){const t=(h.length?h:s).filter(t=>t.time===p);if(1===t.length)return t[0]}return h.length?h.sort((t,n)=>t.time.localeCompare(n.time))[0]:void 0}const z=t=>`${t.name}, ${t.partySize} at ${t.time}${t.table?`, table ${t.table}`:''}`,F=[{name:'booking',type:'string',required:!0,description:'Guest name, booking reference or time, as said'},{name:'table',type:'string',description:'Table, if said'}],R=t=>({booking:t,table:A(t)}),B='I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.';function H(t,n,a,r,i,s,d,c=""){return{id:t,apps:_,title:n,risk:'change',params:F,keywords:[],description:`${n}: today\u2019s booking by guest name, reference, table or time.${c}`,match:t=>$(t,i)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`${s}: ${z(a)}?${c}`:B},run:async(t,n)=>{const i=P(n.rid,n.today,t.booking,r,x(n.rid,t.table)??(t.table?String(t.table):void 0));return i?'finished'!==a&&'seated'!==a||N(n)?(await l.repo.bookings.setStatus(i.id,a),d&&await d(i,n,t),`Done: ${i.name} ${'noshow'===a?'marked as a no-show':'cancelled'===a?'cancelled':'finished'===a?'finished':a}.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}}}const U=(t,n)=>(0,u.tablesOf)(n).forEach(n=>u.useFloor.getState().setLive(t,n,{stage:'seated',dirty:!1})),W={id:'seat_booking',apps:_,title:'Seat a booking',risk:'change',params:F,keywords:[],description:'Seat a guest with a booking today (at their booked table, or the table said). Walk-ins use add_walkin.',match:t=>!$(t,/\b(seat|sit)\b/)||$(t,/\b(walk.?in|walkin|no booking)\b/)||$(t,/\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten) (people|covers|guests)\b/)?$(t,/\b(have|has|are|is) (arrived|here)\b/)?7:0:7,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']),o=x(n.rid,t.table)??a?.table;if(!a)return B;const i=o?T(n.rid,(0,u.tablesOf)(o)[0]):{};return`Seat ${a.name}, ${a.partySize} at ${a.time}${o?`, at table ${o}`:' (no table yet)'}?${i.blocked?` ${(0,r.tableNumbers)(o)} is marked blocked.`:i.dirty?` ${(0,r.tableNumbers)(o)} still needs clearing.`:i.stage?` ${(0,r.tableNumbers)(o)} already has people seated.`:''}`},run:async(t,n)=>{const a=P(n.rid,n.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.";if(!N(n))return'Nothing changed. '+o.SEAT_CLEAR_HINT;const r=x(n.rid,t.table);return t.table&&!r?`Nothing changed: there\u2019s no table ${t.table} on the plan.`:(r&&r!==a.table&&await l.repo.bookings.update(a.id,{table:r}),await l.repo.bookings.setStatus(a.id,'seated'),U(n.rid,r??a.table),`Done: ${a.name} seated${r??a.table?` at table ${r??a.table}`:''}.`)}},G={id:'finish_booking',apps:_,title:'Finish a table (party left)',risk:'change',params:F,keywords:[],description:'Mark a seated party as finished. The table is then marked as needing clearing. A 15-second Undo is offered.',match:t=>$(t,/\b(finished|have left|has left|left|gone|paid and gone|party left|they'?re done)\b/)?7:0,parse:R,preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?`Mark finished: ${z(a)}? The table is then marked as needing clearing.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['seated'],x(n.rid,t.table)??(t.table?String(t.table):void 0));return a?N(n)?(await(0,i.finishBookingNow)(n.rid,a),(0,s.offerFinishUndo)({rid:n.rid,bookings:[a],name:a.name,table:a.table,big:!0}),`Done: ${a.name} finished.`):'Nothing changed. '+o.SEAT_CLEAR_HINT:"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d."}},V=H('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'),K=H('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.'),Y={id:'move_booking',apps:_,title:'Move a booking to another table',risk:'change',params:[F[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=>$(t,/\b(move|put|switch|change)\b/)&&$(t,/\btables?\b/)&&!$(t,/\b(shift|rota)\b/)?7:0,parse:t=>{const n=[...t.matchAll(new RegExp(D.source,'gi'))],a=n[n.length-1];return{booking:t,table:a?String(L(a[1])??a[1]).toUpperCase():void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),o=x(n.rid,t.table);return a?o?'finished'===a.status?`${a.name} is finished. Seat them at table ${o}?`:`Move ${z(a)} to table ${o}?${T(n.rid,o).stage||T(n.rid,o).blocked?` ${(0,r.tableNumbers)(o)} is not free.`:''}`:`There\u2019s no table ${t.table??''} on the plan.`:B},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending','seated','finished']),r=x(n.rid,t.table);if(!a)return"Nothing changed. I couldn\u2019t find that booking today. Say the guest\u2019s name, for example \u201cSmith at 7\u201d.";if(!r)return'Nothing changed: I couldn\u2019t find that table on the plan.';if('finished'===a.status)return await(0,s.restoreFinishedToTable)(n.rid,a,[r]),`Done: ${a.name} seated again at table ${r}.`;const o=a.table;return await l.repo.bookings.update(a.id,{table:r,tableSetHere:!0}),'seated'===a.status&&((0,u.tablesOf)(o).forEach(t=>u.useFloor.getState().setLive(n.rid,t,{stage:void 0,dirty:!0})),U(n.rid,r)),`Done: ${a.name} moved to table ${r}.`}},J={id:'change_booking',apps:['owner','staff'],title:'Change a booking\u2019s time or party size',risk:'change',params:[F[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=>$(t,/\b(change|make it|now|instead|update|actually)\b/)&&$(t,/\b(booking|reservation|party)\b/)&&$(t,/\b(\d|one|two|three|four|five|six|seven|eight|nine|ten)\b/)?6:0,parse:t=>{const n=t.toLowerCase(),a=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))/),r=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:a&&/people|covers|guests|pax|party|for/.test(n)&&!r?.[1]?.startsWith(a[1])?L(a[1]):void 0,time:r?E(r[1].replace(/o'?clock/,''))??void 0:void 0}},preview:(t,n)=>{const a=P(n.rid,n.today,t.booking,['confirmed','pending']);return a?t.time||t.covers?`Change ${z(a)} 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 ${a.name}\u2019s booking? Say the new time or number of people.`:B},run:async(t,a)=>{const r=P(a.rid,a.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 o=L(t.covers);if(!(null==t.covers||o&&(0,n.validParty)(o)))return`Nothing changed: ${n.PARTY_RULE}`;const i=t.time?E(String(t.time)):null;return o||i?(await l.repo.bookings.update(r.id,{...o?{partySize:o}:{},...i?{time:i}:{}}),`Done: ${r.name} is now ${o??r.partySize} at ${i??r.time}.`):'Nothing changed.'}},Q={id:'decide_booking',apps:['owner'],title:'Accept or decline a booking request',risk:'change',params:[F[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=>$(t,/\b(accept|approve|confirm|decline|reject|turn down)\b/)&&$(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 a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?`${'declined'===t.outcome?'Decline':'Accept'} the request from ${a.name}, ${a.partySize} on ${v(a.date)} at ${a.time}?`:'I couldn\u2019t find a waiting request with that name.'},run:async(t,n)=>{const a=P(n.rid,n.today,t.booking,['pending'])??c.useStore.getState().bookings.find(a=>a.restaurantId===n.rid&&'pending'===a.status&&M(a.name).some(n=>M(String(t.booking)).includes(n)));return a?(await l.repo.bookings.decide(a.id,'declined'===t.outcome?'declined':'confirmed',C(n)),`Done: ${a.name}\u2019s request ${'declined'===t.outcome?'declined':'accepted'}.`):'Nothing changed: I couldn\u2019t find a waiting request with that name.'}},X=[{name:'table',type:'string',required:!0,description:'Table name or number'}],Z={id:'table_cleared',apps:_,title:'Mark a table cleared',risk:'change',params:X,keywords:[],description:'Mark a table cleared and free (after clearing it down).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(cleared|clear(ed)? down|is clean|wiped|reset|is free|is ready|ready again)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} cleared and free?${T(n.rid,a).stage?' People are still marked as seated there.':''}`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!1,stage:void 0}),`Done: table ${a} is free.`):'Nothing changed: I couldn\u2019t find that table.'}},ee={id:'table_needs_clearing',apps:_,title:'Mark a table as needing clearing',risk:'change',params:X,keywords:[],description:'Mark a table as needing clearing (dirty).',match:t=>$(t,/\btables?\b/)&&$(t,/\b(needs? (clearing|clearing down|a clean|wiping)|dirty|to be cleared)\b/)?8:0,parse:t=>({table:A(t)}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Mark table ${a} as needing clearing?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{dirty:!0,stage:void 0}),`Done: table ${a} needs clearing.`):'Nothing changed: I couldn\u2019t find that table.'}},te={id:'block_table',apps:_,title:'Block or unblock a table',risk:'change',params:[...X,{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=>$(t,/\b(un.?block|block|out of use|not in use|close)\b/)&&$(t,/\btables?\b/)&&!$(t,/\barea\b/)?8:0,parse:t=>({table:A(t),blocked:/\b(un.?block|back in use|open)\b/i.test(t)?'no':'yes'}),preview:(t,n)=>{const a=x(n.rid,t.table);return a?`${'no'===t.blocked?'Unblock':'Block'} table ${a}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table);return a?(u.useFloor.getState().setLive(n.rid,a,{blocked:'no'!==t.blocked}),`Done: table ${a} ${'no'===t.blocked?'unblocked':'blocked'}.`):'Nothing changed: I couldn\u2019t find that table.'}},ne={mains:'mains',main:'mains',dessert:'dessert',desserts:'dessert',pudding:'dessert',bill:'bill',check:'bill',seated:'seated',starters:'seated'},ae={id:'table_stage',apps:_,title:'Set a table\u2019s course',risk:'change',params:[...X,{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=>$(t,/\btables?\b/)&&$(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:A(t),stage:n?ne[n[1]]:void 0}},preview:(t,n)=>{const a=x(n.rid,t.table);return a?`Set table ${a} to ${t.stage}?`:`There\u2019s no table ${t.table??''} on the plan.`},run:(t,n)=>{const a=x(n.rid,t.table),r=ne[String(t.stage??'').toLowerCase()];return a&&r?(u.useFloor.getState().setLive(n.rid,a,{stage:r,dirty:!1}),`Done: table ${a} is on ${r}.`):'Nothing changed: say the table and mains, dessert or bill.'}},re=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),oe=t=>/\b(roast|chickens?|beef)\b/.test(t)&&!/\b(sold out|86|off the menu|menu|dish|special|allerg)/.test(t)&&Object.values(b.useShellStore.getState().items).some(t=>t.some(t=>t.active&&(0,h.isRoastItem)(t))),ie=t=>(b.useShellStore.getState().items[t]??[]).filter(t=>t.active),se=(t,n)=>{const a=String(n??'').toLowerCase();return ie(t).find(t=>[t.name,t.plural,t.key].some(t=>t&&new RegExp(`\\b${t.toLowerCase().replace(/[^a-z0-9 ]/g,'')}`).test(a)))},de={id:'shellfish_count',apps:q,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=>!$(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)&&!oe(t)||$(t,/\b(allerg|contain|chat|message|tell|text|post)/)||re(t)||!$(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,a)=>{const r=n.toLowerCase(),o=r.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(r)?'delivery':/\b(count|we have|we'?ve got|there are|recount|left in)\b/.test(r)?'count':'sold',s=se(a.rid,r);return s&&(0,t.fishInStone)(a.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:L(o[1]):1,mode:i}},preview:(n,r)=>{const o=se(r.rid,n.item);if(!o||'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'I couldn\u2019t find that item in the shellfish counts.';if((0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||!Number.isInteger(2*a))return'Use stone in half-stone steps, for example one and a half stone.';const i=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,s=(0,t.fromStone)(a,o.unit),d='count'===n.mode?s:'delivery'===n.mode?i+s:i-s;return`${o.name}: ${n.mode} ${(0,t.stoneSpeech)(a)}, after ${(0,t.stoneSpeech)((0,t.toStone)(Math.max(0,d),o.unit))}?`}const i=L(n.qty)??0,s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i:'delivery'===n.mode?s+i:s-i;return`${'count'===n.mode?`Set ${o.plural||o.name} to ${(0,h.fmtCount)(i)}`:'delivery'===n.mode?`Add a delivery of ${(0,h.fmtCount)(i)} ${o.plural||o.name}`:`Record ${(0,h.fmtCount)(i)} ${1===i?o.name:o.plural||o.name} sold`} (now ${(0,h.fmtCount)(s)}, after ${(0,h.fmtCount)(Math.max(0,d))})?`},run:(n,r)=>{const o=se(r.rid,n.item);if(o&&'chef'===r.app&&!(0,a.chefCanSee)(r.rid,o))return'Nothing changed: that item is not in Head Chef stock.';if(o&&(0,t.fishInStone)(r.rid,o)){const a=(0,t.parseStoneAmount)(n.qty??'');if(null==a||a<0||a>500||!Number.isInteger(2*a))return'Nothing changed: use stone in half-stone steps.';const i=(0,t.fromStone)(a,o.unit),s=(0,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d='count'===n.mode?i-s:'delivery'===n.mode?i:-i;return s+d<0?`Nothing changed: only ${(0,t.stoneSpeech)((0,t.toStone)(s,o.unit))} left.`:(d&&b.shellfish.append({rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner',delta:d,reason:'count'===n.mode?'count':'delivery'===n.mode?'delivery':'sold'}),`Done: ${o.name}, ${(0,t.stoneSpeech)((0,t.toStone)(s+d,o.unit))} left.`)}const i=L(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,b.venueCounts)(b.useShellStore.getState(),r.rid)[o.key]??0,d={rid:r.rid,kind:o.key,by:C(r),app:r.app??'owner'};return'count'===n.mode?(i!==s&&b.shellfish.append({...d,delta:i-s,reason:'count'}),`Done: ${o.plural||o.name} counted at ${(0,h.fmtCount)(i)}.`):'delivery'===n.mode?i<=0?'Nothing changed.':(b.shellfish.append({...d,delta:i,reason:'delivery'}),`Done: ${(0,h.fmtCount)(i)} in. ${(0,h.fmtCount)(s+i)} now.`):s($(t,/\b(lobsters?|crabs?|langoustines?|oysters?|scallops?|mussels?|shellfish|haddock|salmon|cod|hake|fish)\b/)||oe(t))&&re(t)&&!$(t,/\b(allerg|contain)/)?8:0,parse:(t,n)=>({item:se(n.rid,t)?.name}),preview:()=>'Shellfish left',run:(n,r)=>{const o=(0,b.venueCounts)(b.useShellStore.getState(),r.rid),i=se(r.rid,n.item),s=(i?[i]:ie(r.rid).filter(t=>!(0,h.isRoastItem)(t)||(0,h.isSundayIn)(new Date))).filter(t=>'chef'!==r.app||(0,a.chefCanSee)(r.rid,t));return s.length?s.map(n=>`${n.plural||n.name}: ${(0,t.fishInStone)(r.rid,n)?(0,t.stoneSpeech)((0,t.toStone)(o[n.key]??0,n.unit)):(0,h.fmtCount)(o[n.key]??0)} left`).join('. ')+'.':'No shellfish counts are set up here.'}},ce={accept:'acknowledged',preparing:'preparing',ready:'ready',collected:'collected'},ue=(t,n)=>{const a=String(n??'').toLowerCase(),r=c.useStore.getState().orders.filter(n=>n.restaurantId===t&&!['closed','cancelled','collected','served'].includes(n.status));return r.find(t=>t.ref&&a.includes(t.ref.toLowerCase()))??r.find(t=>{const n=a.match(/\b(?:number|no\.?|order)\s*(\d{1,4})\b/);return!!n&&t.ref.replace(/\D/g,'').endsWith(n[1])})??(()=>{const t=r.filter(t=>M(t.customerName??'').some(t=>M(a).includes(t)));return 1===t.length?t[0]:void 0})()},be={id:'order_status',apps:q,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=>$(t,/\b(orders?|takeaways?|collection|ticket)\b/)&&$(t,/\b(accept|ready|collected|picked up|preparing|start(ed)?|on it)\b/)&&!$(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 a=ue(n.rid,t.order);return a?`Mark order ${a.ref} for ${a.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 a=ue(n.rid,t.order),r=ce[String(t.status)];if(!a||!r)return'Nothing changed: I couldn\u2019t find that order.';if('acknowledged'===r){return await l.repo.orders.accept(a.id,C(n))?`Done: order ${a.ref} accepted.`:`Order ${a.ref} was already accepted.`}return await l.repo.orders.setStatus(a.id,r,C(n)),`Done: order ${a.ref} is ${r}.`}},he={id:'order_list_add',apps:q,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=>$(t,/\b(add|put)\b.*\b(to|on)\b.*\b(order|shopping|cash and carry|list)\b|\bwe need (more )?\w+/)&&!$(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:L(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 a=p.useOrderLists.getState().lists.filter(t=>t.rid===n.rid),r=String(t.list??'').toLowerCase(),o=r&&a.find(t=>t.name.toLowerCase().includes(r))||a[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 a=p.useOrderLists.getState(),r=a.lists.filter(t=>t.rid===n.rid),o=String(t.list??'').toLowerCase(),i=o&&r.find(t=>t.name.toLowerCase().includes(o))||r[0],s=String(t.item??'').trim().slice(0,60),d=Math.max(1,Math.min(99,Math.round(L(t.qty)??1)));if(!i||s.length<2)return'Nothing changed: say what we need.';const l={id:n.whoId??'assistant',name:C(n)},c=a.items.find(t=>t.rid===n.rid&&t.listId===i.id&&'open'===t.status&&t.name.toLowerCase()===s.toLowerCase());return c?(a.bump(c.id,d,l),`Done: added ${d} more ${s} on ${i.name}.`):(a.addItem(n.rid,{listId:i.id,name:s,qty:d,unit:'',addedBy:l.id,addedByName:l.name}),`Done: ${d} ${s} added to ${i.name}.`)}},pe={in:'Clock you in',out:'Clock you out',break_start:'Start your break',break_end:'End your break'};function me(t,n,a){return{id:t,apps:O,title:pe[n].replace('you','me').replace('your','my'),risk:'change',params:[],keywords:[],description:`${pe[n]} now (only for the person signed in; the same location check as the Clock tab).`,match:t=>$(t,a)?8:0,preview:()=>`${pe[n]} now?`,run:async(t,a)=>{if(!a.whoId)return'Sign in to the Staff app first.';const r=S().toISOString(),o=await(0,f.clockAction)(n,{rid:a.rid,staffId:a.whoId,date:a.today,at:r});return o.ok?'Done: '+{in:'clocked in',out:'clocked out',break_start:'break started',break_end:'break ended'}[n]+` at ${new Date(r).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}.`+(o.warn?' '+o.warn:''):'Nothing changed: '+o.message}}}const ge=me('clock_in','in',/\bclock (me )?in\b|\bclocking in\b|\bstart(ing)? my shift\b/),fe=me('clock_out','out',/\bclock (me )?out\b|\bclocking out\b|\b(finish|end)(ing)? my shift\b/),ye=me('break_start','break_start',/\b(start|starting|taking|take|going on|begin)( my| a)? break\b|\bon (my )?break now\b/),ke=me('break_end','break_end',/\b(end|ending|finish|finished|back from)( my| a| the)? break\b|\bback from break\b/),we=t=>{const n=m.useOwner.getState().staff,a=String(t??'').toLowerCase();return n.find(n=>n.id===t)?.id??n.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>M(a).includes(t)))?.id},ve=(t,n)=>{if(!(0,y.hasRecipeCards)())return;const a=M(String(n??''));let r;for(const n of(0,y.recipeCards)().list(t)){const t=M(n.dish).filter(t=>a.includes(t)).length;t&&t>(r?.s??0)&&(r={c:n,s:t})}return r?.c},Se=t=>{const n=w.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'},$e=[W,G,V,K,Y,J,Q,Z,ee,te,ae,de,le,be,he,ge,fe,ye,ke,{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=>$(t,/\b(approve|accept|decline|reject|ok|okay)\b/)&&$(t,/\b(holiday|leave|time off|day off|days off)\b/)?7:0,parse:t=>{const n=t.toLowerCase(),a=m.useOwner.getState().staff.find(t=>t.active&&M(t.name.replace(' (example)','')).some(t=>new RegExp(`\\b${t}\\b`).test(n)));return{staffId:a?.id,outcome:/\b(decline|reject|refuse)\b/.test(n)?'declined':'approved'}},preview:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status),o=n.staff.find(t=>t.id===a)?.name.replace(' (example)','');return r?`${'declined'===t.outcome?'Decline':'Approve'} ${o}\u2019s holiday, ${v(r.from)}${r.to!==r.from?` to ${v(r.to)}`:''}?`:`There\u2019s no waiting holiday request${o?` from ${o}`:''}.`},run:t=>{const n=m.useOwner.getState(),a=we(t.staffId),r=n.leave.find(t=>t.staffId===a&&'pending'===t.status);return r?(n.setLeave(r.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=>$(t,/\bsign(ed)?.?off\b|\bapprove\b.*\b(card|recipe|allergens?)\b/)?8:0,parse:t=>({dish:t}),preview:(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?`${a.dish} can\u2019t be signed off yet: ${r}`:`Sign off ${a.dish}? Allergens: ${Se(a.allergens)}.`},run:async(t,n)=>{const a=ve(n.rid,t.dish);if(!a)return'Nothing changed: I couldn\u2019t find that recipe card.';const r=(0,k.signOffBlock)(a);return r?'Nothing changed: '+r:(await(0,y.recipeCards)().signOff(a.id,{name:C(n),role:'head-chef'}),`Done: ${a.dish} signed off.`)}}]},1536,[896,1100,820,843,1121,1098,1115,922,858,816,998,895,897,1010,876,1067,867,847,845]); +__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]),n=_r(_d[3]),r=_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?'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)=>r.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(),n=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(n){const e=Number(/\d/.test(n[1])?n[1]:n[2]),a=L.indexOf(/\d/.test(n[1])?n[2]:n[1]);let r=Number(t.slice(0,4));return`${r}-${A(a+1)}-${A(e)}`e.active)){const n=[N(e.name).split(' ')[0],e.nickname].filter(Boolean).map(e=>e.toLowerCase()),r=Math.min(...n.map(e=>{const a=t.match(new RegExp(`\\b${e.replace(/[^a-z']/g,'')}\\b`));return a?.index??1/0}));r<1/0&&a.push({s:e,at:r})}return a.sort((e,t)=>e.at-t.at).map(e=>e.s)}const F=e=>r.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(),n=U(e);if(!n.length)return;const r=a.match(/(?:#|number|no\.?)\s*(\d{1,3})\b/);if(r)return n.find(e=>e.number===Number(r[1]));const i=(0,$.tokensOf)(a).filter(e=>!['waitlist','wait','list','off','remove','told','ready','next'].includes(e)),s=n.filter(e=>(0,$.tokensOf)(e.name).some(e=>i.includes(e)));return s.length?s[0]:/\b(next|first)\b/.test(a)||1===n.length?n[0]:void 0}const Y=e=>`waitlist number ${e.number}, ${e.name}, party of ${e.partySize}`;function B(e,t){const r=a.useStore.getState(),i=r.restaurants.find(t=>t.id===e);if(!i)return;const s=(0,$.appNow)(),o=(0,l.ymdOf)(s),d=n.useFloor.getState(),c=d.plans[e]??(0,n.seedPlan)(e),h=r.bookings.filter(t=>t.restaurantId===e),p=(0,w.closedAreasAt)(w.useBlocks.getState().blocks,e,o,D()),f=(0,b.floorView)(c,h,r.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 n=(0,$.resolveTable)(t.rid,e.table)??B(t.rid,a.partySize);return n?`Seat ${Y(a)}, at table ${n}?`:`There\u2019s no free table for ${a.partySize} right now. Say a table to seat them anyway.`},run:async(e,a)=>{const r=z(a.rid,e.who);if(!r)return'Nothing changed: I couldn\u2019t find that party on the waitlist.';const i=(0,$.resolveTable)(a.rid,e.table)??B(a.rid,r.partySize);return i?(await t.repo.waitlist.setStatus(r.id,'seated'),await t.repo.bookings.seatWalkIn(a.rid,r.partySize,i,`From waitlist #${r.number}`),(0,n.tablesOf)(i).forEach(e=>n.useFloor.getState().setLive(a.rid,e,{stage:'seated',dirty:!1})),`Done: waitlist number ${r.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=r.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),n=j(String(t??''),e.today);return n?a.find(e=>e.date===n):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(),n=a.match(/\bfrom\s+(.+?)\s+(?:to|until|till)\s+(.+)$/);if(n){const e=j(n[1],t),a=j(n[2],t)??e;return{from:e,to:a&&e&&a'open'===e.status&&(!n||e.kind===n)),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 ne(e,t){const a=(0,m.weekStart)(new Date(e+'T12:00:00')),n=new Date(a+'T00:00:00').getTime(),r=n+6048e5,s=i.useSafety.getState().entries.filter(e=>{const a=new Date(e.at).getTime();return a>=n&&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>=n&&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)()),n=new Date(`${a.ymd}T12:00:00Z`).getUTCDay(),r=(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=>r.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),n):[];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 n;for(const t of oe(e)){const e=(0,$.tokensOf)(t.name).filter(e=>a.includes(e)).length;e&&e>(n?.s??0)&&(n={m:t,s:e})}return n?.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 n=z(a.rid,e.who);return n?(await t.repo.waitlist.setStatus(n.id,'removed'),`Done: number ${n.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,r)=>{const i=z(r.rid,e.who);if(!i)return'Nothing changed: I couldn\u2019t find that party.';const s=a.useStore.getState().restaurants.find(e=>e.id===r.rid);return n.useFloor.getState().logSms(r.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?r.useOwner.getState().swaps.some(e=>e.shiftId===a.id&&'open'===e.status)?'There\u2019s already an open request for that shift.':(r.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),n=E(e.with);return n&&n.id!==t.whoId?a?`Ask to swap your shift on ${G(a)} with ${N(n.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),n=E(e.with);return a&&t.whoId?n&&n.id!==t.whoId?(r.useOwner.getState().addSwap({shiftId:a.id,fromId:t.whoId,toId:n.id,kind:'swap',note:'Agreed between us'}),`Done: swap with ${N(n.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)())),n=e.match(/\b(?:for|because)\s+(?:a |an |my )?([a-z][a-z ]{2,40}?)\s*$/i);return{...a,reason:n&&!/\b(from|to|monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|\d)/i.test(n[1])?n[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=r.useOwner.getState().shifts.find(e=>e.id===t.shiftId),n=N(F(t.fromId)?.name),i=N(F(t.toId)?.name),s='swap'===t.kind?`${n}\u2019s swap with ${i}`:t.toId?`${i} covering ${n}`:`${n}\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 ${n}\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=r.useOwner.getState(),n=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)}${n?` (${M[n.day]} ${R(n.start)}\u2013${R(n.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 n=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: ${n.n} checks, ${n.bad} out of range${n.bad?`, ${n.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:n}=ne(t.today,t),r=(i.useSafety.getState().weekly??[]).find(e=>e.week===a);if(r)return`This week is already signed off by ${r.by}.`;const s=`Week of ${(0,$.niceDay)(a)}: ${n.entries} checks, ${n.outOfRange} out of range, ${n.actions} with an action, diary signed ${n.daysSigned} of 7 days.`;return n.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:n}=ne(t.today,t);return(i.useSafety.getState().weekly??[]).some(e=>e.week===a)?'This week is already signed off.':n.actions!0),note:'Signed by voice: yes to all.',summary:n}),'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),n=String(e.location??t.location);return`Add to the accident book: when, today at ${D()}; who, ${a} (${t.personType}); where, ${n}; 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)),n='Near miss'===a.category,r=(0,$.appNow)();return i.useSafety.getState().addAccident({when:`${(0,l.ymdOf)(r)}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??'')||(n?'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:n,rem:r}=se(t,e.task);return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?`${_(n.text)} is already ticked today.`:`Tick off today\u2019s task ${_(n.text)}?`:r?`Mark the reminder ${_(r.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:n,rem:r}=se(t,e.task),i={id:t.whoId,name:N(I(t))};return n?s.useDailyTasks.getState().ticks.some(e=>e.id===(0,s.tickId)(t.rid,t.whoId,n.id,a))?'Already ticked today.':(s.useDailyTasks.getState().toggleTick(t.rid,t.whoId,n.id,a,i),`Done: ${_(n.text)} ticked.`):r?(c.useReminders.getState().markDone({rid:t.rid,reminderId:r.id,forDate:a,at:(0,$.appNow)().toISOString(),staffRef:t.whoId,staffName:i.name}),`Done: ${_(r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t?.rid),r=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=n?.sections.find(e=>r.includes(e.toLowerCase())||r.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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=String(e.section??n?.sections[0]??'Mains');return`Add ${_(String(e.name))} to ${r} 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 n=a.useStore.getState().restaurants.find(e=>e.id===t.rid),r=Number(e.price),i=String(e.name??'').trim();return i.length<2||!Number.isFinite(r)||r<=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??n?.sections[0]??'Mains'),name:i,description:String(e.description??''),price:r,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 n=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 n?{dish:n[1],field:'description',value:n[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 n=de(t.rid,e.dish),r=String(e.value??'').trim();return n?r.length<2?'Nothing changed: say the new wording.':(a.useStore.getState().updateMenuItem(n.id,'name'===e.field?{name:r}:{description:r}),'name'===e.field?`Done: renamed to ${r}.`:`Done: description of ${n.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 n=(0,$.findCard)(t.rid,a.dish);return n?`Add ${[a.qty,a.unit].filter(Boolean).join(' ')} ${a.name} to ${n.dish}\u2019s recipe card?${n.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)),n=a&&(0,$.findCard)(t.rid,a.dish);return a&&n?(await(0,y.recipeCards)().update(n.id,{ingredients:[...n.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 ${n.dish}.${n.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,n=String(e.step??'').trim();return!a||n.length<3?'Nothing changed: I need the dish and the step.':(await(0,y.recipeCards)().update(a.id,{steps:[...a.steps,n]},{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],n=e.match(/\b(?:reason|because|as)\b[:,]?\s*(.+)$/i),r=/\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:r,reason:n?.[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 n=e.action??'in',r=(0,g.managerClockAction)(n,{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 r.ok?`Done: ${N(a.name)} ${{in:'clocked in',out:'clocked out',break_start:'on a break',break_end:'back from break'}[n]} at ${D()}.${r.warn?' '+r.warn:''}`:'Nothing changed: '+r.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 n=h.useCashUp.getState(),r=a.useStore.getState().restaurants.find(e=>e.id===t.rid),i=(0,f.payFor)(t.rid,r?.settings.pay,u.useOnboard.getState().answers).pay,s=(0,p.tipsPot)(n.tips.filter(e=>e.rid===t.rid),n.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: 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 n='yesterday'===e.day?(0,l.ymdOf)(a):e.day,r=h.useCashUp.getState().cashUps.filter(e=>e.rid===t.rid&&(!n||e.date===n)).sort((e,t)=>t.date.localeCompare(e.date)),i=r[0];return i?`Cash-up for ${(0,$.niceDay)(i.date)}: takings ${fe((0,p.tillTakingsOf)(i.vals))} (card + cash \u2212 card tips), tips ${fe((0,p.combinedTips)(i.vals))} (cash and card). ${i.confirmedAt?`Confirmed${i.confirmedBy?` by ${i.confirmedBy}`:''}.`:'Not confirmed yet.'}`:n?`There\u2019s no cash-up for ${(0,$.niceDay)(n)}.`:'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 r='clear'===e.note?'':String(e.note??'').trim().slice(0,80);return(0,n.tablesOf)(a).forEach(e=>n.useFloor.getState().setLive(t.rid,e,{note:r||void 0})),r?`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 n=(0,$.appNow)();return r.useOwner.getState().addLost({item:a,where:String(e.where??'').trim()||'Not noted',foundAt:`${(0,l.ymdOf)(n)} ${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',n=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),r=e.match(/\bat\s+(\d{1,2}(?:[:.]\d{2})?\s*(?:am|pm)?)/i);return{text:n?.[1]?.trim(),time:r?(0,$.hm)(r[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??''),n=a.charAt(0).toUpperCase()+a.slice(1);return`Add a reminder for ${ye[e.audience??'all']}: ${_(n)}, ${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(),n=String(e.time??'');if(a.length<2||!/^\d{2}:\d{2}$/.test(n))return'Nothing changed: I need the wording and a time like 21:00.';const r=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:r,time:n,audience:e.audience??'all'}),'Done: reminder added.'}}]},1537,[820,858,816,998,876,1003,1014,1015,927,926,1008,839,1034,1035,1036,1004,1067,867,1076,995,854,1538,1536]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.dishesFor=_,_e.findDish=F,_e.allergensSaid=q,_e.timeFrom=G,_e.coversFrom=P,_e.dateFrom=U,_e.nameFrom=J,Object.defineProperty(_e,"VOICE_ACTIONS",{enumerable:!0,get:function(){return ee}});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]),h=_r(_d[12]),u=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),y=_r(_d[18]),w=_r(_d[19]);const v=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},k=e=>String(e).padStart(2,'0'),S=e=>e.getFullYear()+'-'+k(e.getMonth()+1)+'-'+k(e.getDate()),N=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'})},I=(e,t)=>t.test(e),A=(e,t)=>e+' '+t+(1===e?'':'s'),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},x=e=>null==e?void 0:T[e.toLowerCase()]??(Number.isFinite(Number(e))?Number(e):void 0),D=e=>e.who??('display'===e.app?'Display':'Assistant'),C={owner:'Managers',staff:'Staff',chef:'Head Chef',display:'Main Display'},O=e=>C[e.app??'owner'],L=new Set(['the','and','with','our','for']),R=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,' ').split(/\s+/).filter(e=>e.length>2&&!L.has(e));function _(e){const t=s.useStore.getState(),r=(0,p.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=c.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=>e.replace(/s$/,'');function F(e,t){const r=new Set(R(e).map(E)),a=e.toLowerCase();let n;for(const e of _(t)){const t=R(e.name);if(!t.length)continue;const o=t.filter(e=>r.has(E(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 M=[[/\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 q(e){const t=new Set;for(const[r,a]of M)r.test(e)&&a.forEach(e=>t.add(e));return[...t]}const z=e=>h.ALLERGENS.find(t=>t.id===e)?.short??e,j='Always check the signed-off recipe card and tell the kitchen about any allergy.';function H(t,r){if('chef'===r?.app&&(0,e.isAnchorage)(r.rid)&&(0,e.isBarFridge)(t))return[];const a=l.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,g.parseQuick)(t,a).filter(e=>e.point).map(e=>{const t=(0,g.isTempKind)(e.point.kind);return{pointId:e.point.id,value:t?e.value:null,done:t?void 0:n}})}const Y=e=>{try{return JSON.parse(String(e.readings??'[]'))}catch{return[]}};function B(e){const t=l.useSafety.getState().points.find(t=>t.id===e.pointId);return t?(0,g.isTempKind)(t.kind)?null==e.value?t.name+': no temperature heard':t.name+': '+e.value+'\xb0C '+((0,g.inRange)(t,e.value)?'(safe)':'OUT OF RANGE (safe: '+(0,g.limitText)(t)+')'):t.name+': '+(e.done?'done':'NOT done'):'?'}function G(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=x(t[1])??0;return r>=1&&r<=10&&(r+=12),k(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:k(r)+':'+k(a)}function P(e){const t=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=x(t?.[1]);return a&&(0,r.validParty)(a)?a:void 0}const Z=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function U(e,t){const r=new Date(t+'T12:00:00');if(/\btomorrow\b/.test(e))return r.setDate(r.getDate()+1),S(r);const a=Z.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))),S(r)}return t}function K(e,t,r,a){const n=s.useStore.getState(),o=n.restaurants.find(t=>t.id===e),i=d.useFloor.getState().plans[e]??(0,d.seedPlan)(e),l=o?.settings.turnMins??90,c=n.bookings.filter(r=>r.restaurantId===e&&r.date===t);return(0,u.freeTablesAt)(i,c,a,new Date(t+'T'+r+':00'),(0,u.turnFor)(a,l),l)}const W=(e,t)=>{const[r,a]=e.split(':').map(Number),n=60*r+a+t;return k(Math.floor(n/60))+':'+k(n%60)},$=e=>e.replace(/^\w/,e=>e.toUpperCase());function J(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?$(t[1]):void 0}const V=e=>!/\b(how do i|how do you|where do i|how to)\b/.test(e),Q=e=>!['collected','served','closed','cancelled'].includes(e.status),X=e=>e.toUpperCase().replace(/[\s-]/g,''),ee=[{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=>I(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=s.useStore.getState(),a=v(),n=S(a),o=r.restaurants.find(e=>e.id===t.rid);if(!o)return'I can\u2019t see this venue\u2019s tables yet.';const i=d.useFloor.getState(),l=i.plans[t.rid]??(0,d.seedPlan)(t.rid),c=r.bookings.filter(e=>e.restaurantId===t.rid),p=(0,f.closedAreasAt)(f.useBlocks.getState().blocks,t.rid,n,k(a.getHours())+':'+k(a.getMinutes())),h=(0,u.floorView)(l,c,r.orders.filter(e=>e.restaurantId===t.rid),i.live[t.rid]??{},a,o.settings.turnMins,p);return(0,m.nextFreeSentence)((0,m.nextTablesFree)(o,h,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=>V(e)&&I(e,/\b(fridges?|freezers?|temps?|temperatures?|degrees|probe|core temp|hot hold|cooling|cleaning|clean down|deep clean)\b/)&&(!I(e,/\b(seat|seated|party|covers?|people|guests?|table \w+|walk.?ins? (of|for)|just arrived)\b/)||I(e,/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus)\b/))?3:0,parse:(e,t)=>({readings:JSON.stringify(H(e,t))}),preview:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(t).filter(e=>a.some(t=>t.id===e.pointId));return n.length?'Log in the food safety log: '+n.map(B).join('; ')+'?':'I didn\u2019t catch which fridge, freezer or check. Try \u201cprep fridge 3 degrees\u201d.'},run:(t,r)=>{const a=l.useSafety.getState().points.filter(t=>'chef'!==r.app||(0,e.chefCanSee)(r.rid,t)),n=Y(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,g.isTempKind)(t.kind)&&null==e.value}))return'Nothing logged: a temperature was missing. Say the number, for example \u201cfreezer minus 19\u201d.';const o=v().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,g.isTempKind)(t.kind),s=n?(0,g.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:D(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}});l.useSafety.getState().addEntries(s);const d=s.filter(e=>!e.ok);return d.length?'Logged. '+d.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=>!I(e,/(allergens?|allerg(y|ic|ies)|contains?|coeliac|celiac|safe for|free from|.free\b|intoleran)/)||I(e,/\b(sold out|price|draft)\b/)||I(e,/\btables?\b.*\bfree\b|\bfree\b.*\btables?\b/)?0:3,parse:(e,t)=>{const r=F(e,t.rid);let a=e.toLowerCase();if(r)for(const e of R(r.name))a=a.replace(new RegExp('\\b'+e+'\\b','g'),' ');return{dish:r?.name,allergens:q(a).join(',')}},preview:e=>'Allergens'+(e.dish?' in '+e.dish:''),run:(e,t)=>{const 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=h.ALLERGENS.filter(e=>'contains'===a.allergens[e.id]).map(e=>e.short),t=h.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 '+z(e)+'.':'may'===a.allergens[e]?a.name+' MAY CONTAIN '+z(e)+'.':'No '+z(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.')+' '+j}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(z).join(' or ')+' listed'+(e.length?', for example '+e.slice(0,5).map(e=>e.name).join(', '):'')+'. '+t.length+' contain it. '+j}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=>I(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=F(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?((0,t.setSoldOut)(String(e.itemId),'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=>I(e,/\b(price|charge|cost)\b/)&&I(e,/(\xa3|\d|pound)/)&&!I(e,/\b(special|offer)\b/)?3:0,parse:(e,t)=>{const r=F(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,b.gbp)(Number(e.old)):'its current price')+' to '+(null!=e.pence?(0,b.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 i.repo.menu.updateItem(String(e.itemId),{price:r}),'Done: '+e.name+' is now '+(0,b.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=>I(e,/\bspecials?\b/)&&I(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)=>(y.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:D(t),app:O(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=>I(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/)&&!I(e,/\b(sold|back on|allerg)/)?3:0,parse:(e,t)=>{const r=e.toLowerCase();return{covers:P(r),date:U(r,t.today),time:G(r)}},preview:e=>'Check a table for '+(e.covers??'?')+' at '+(e.time??'?')+' on '+(e.date?N(String(e.date)):'today'),run:(e,t)=>{const r=Number(e.covers),a=String(e.time),n=String(e.date??t.today),o=K(t.rid,n,a,r);if(o.length)return'Yes, there\u2019s room for '+r+' at '+a+' on '+N(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=W(a,e);if(K(t.rid,n,o,r).length&&i.push(o),i.length>=3)break}return'No table for '+r+' at '+a+' on '+N(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=>I(e,/\b(book|booking|reserve|reservation)\b/)&&!I(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:P(r),date:U(r,t.today),time:G(r),name:J(e)}},preview:(e,t)=>{const r=e.covers&&e.time?K(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?N(String(e.date)):'?')+'.'+a+' The owner confirms it in Bookings; nothing is sent to the guest now.'},run:(e,t)=>(0,r.validParty)(Number(e.covers))?(y.useDrafts.getState().add({rid:t.rid,kind:'booking',title:'Booking: '+(e.name??'guest')+', '+e.covers+' covers',lines:[N(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:D(t),app:O(t)}),'Saved as a draft booking for the owner to confirm. No confirmation has been sent.'):`Nothing saved. ${r.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=>I(e,/\b(wait ?list|waiting list|queue)\b/)?4:0,parse:e=>({name:J(e)??e.match(/\badd\s+([A-Z][a-z'\u2019-]+)\b/)?.[1],covers:P(e.toLowerCase())}),preview:e=>'Add '+(e.name??'a guest')+', '+(e.covers??'?')+' covers, to the waitlist?',run:async(e,t)=>{const a=Number(e.covers);if(!(0,r.validParty)(a))return`Nothing added: how many people? ${r.PARTY_RULE}`;return'Done: '+(await i.repo.waitlist.join(t.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=>I(e,/\b(orders?|takeaways?|tickets?|collections?)\b/)&&I(e,/\b(read|what|any|list|how many|open|live|waiting|outstanding|pending|due|next)\b/)&&!I(e,/\b(shopping|booker|bidfood|supplier)\b/)?3:0,preview:()=>'Read out the live orders',run:(e,t)=>{const r=s.useStore.getState().orders.filter(e=>e.restaurantId===t.rid&&Q(e)).sort((e,t)=>(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt));if(!r.length)return'No live orders right now.';const n=r.filter(e=>'takeaway'===e.type).length;return A(r.length,'live order')+' ('+n+' takeaway). '+r.slice(0,6).map(e=>{return('takeaway'===e.type?'Takeaway ':(0,a.tableNumbers)(e.tableNo)+' ')+e.ref+' for '+e.customerName+', '+A(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('. ')+(r.length>6?'. And '+(r.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=>I(e,/\b(covers|sales|takings|revenue|forecast|how busy|busy tonight|expected|how many (people|guests|bookings))\b/)&&!I(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=s.useStore.getState(),a=v(),o=S(a),i=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),h=new Date(a);h.setDate(h.getDate()+1);const u=S(h),m=d.filter(e=>e.date===u&&['confirmed','pending'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),f=r.orders.filter(e=>e.restaurantId===t.rid),g=f.filter(e=>e.createdAt.slice(0,10)===o&&'cancelled'!==e.status),y=g.reduce((e,t)=>e+t.subtotal,0);let w='';if(i){const e=(0,n.forecastToday)(i,d,f,r.events,a);w=e.open?e.enough?' Forecast for the rest of today: about '+e.restOfDay.covers+' covers ('+(0,n.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':'')+'. '+A(g.length,'order')+' through CoverCharge so far'+('display'===t.app||'staff'===t.app||'staff'===t.role?'.':', '+(0,b.gbp)(y)+' before tips (till sales aren\u2019t included).')+w+' Tomorrow: '+m+' covers booked so far.'}},{id:'supplier_list',title:'Add to a supplier shopping list',risk:'draft',description:'Add items to a DRAFT shopping list 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=>I(e,/\b(booker|bidfood|bid food)\b/)?4:I(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 supplier 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=y.useDrafts.getState().addToList(t.rid,'bidfood'===e.supplier?'bidfood':'booker',r,D(t),O(t));return'Added to the draft '+a.title+' ('+A(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=>I(e,/\b(offer|promotion|promo|deal|discount|happy hour|two for one|2 for 1)\b/)&&I(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)=>(y.useDrafts.getState().add({rid:t.rid,kind:'offer',title:'New offer',lines:[String(e.text)],by:D(t),app:O(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=>I(e,/\b(event|quiz|live music|tasting|gig|party night|music night|open mic|ceilidh)\b/)&&I(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)?U(e.toLowerCase(),t.today):void 0}),preview:e=>'Save a draft event for the owner to approve: \u201c'+e.text+'\u201d'+(e.date?' on '+N(String(e.date)):'')+'. Nothing is published or sent.',run:(e,t)=>(y.useDrafts.getState().add({rid:t.rid,kind:'event',title:'New event',lines:[String(e.text),...e.date?[N(String(e.date))]:[]],data:{date:e.date},by:D(t),app:O(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=>I(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?X(t[0]):void 0}},preview:e=>'stamp'===e.kind?'Stamp cards':'Gift card '+(e.code??''),run:(e,t)=>{const r=s.useStore.getState();if('stamp'===e.kind&&(0,o.staffServer)())return(0,o.loyaltySummary)().then(e=>A(e.members,'guest')+' have stamp cards here; '+A(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 A(e.length,'guest')+' have stamp cards here; '+A(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),n=r.giftCards.filter(e=>e.restaurantId===t.rid).find(e=>X(e.code)===a||a.length>=4&&X(e.code).includes(a));return n?'Gift card '+n.code+': '+(0,b.gbp)(n.balance)+' left of '+(0,b.gbp)(n.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=>I(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=v().getTime()-6048e5,a=s.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),i=a.filter(e=>e.stars>=5&&e.comment).slice(0,1);return A(a.length,'rating')+' in the last 7 days, averaging '+n.toFixed(1)+' stars.'+(i.length?' Best: \u201c'+i[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=>I(e,/\b(shift note|leave a note|note for|handover|tell the next shift|let the next shift know|note that)\b/)&&!I(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)=>(w.useShiftNotes.getState().add({rid:t.rid,text:String(e.text),by:D(t),app:O(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=>I(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=w.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.'}}]},1538,[820,891,1100,843,1140,1263,858,816,998,1003,910,846,845,1076,1077,995,1004,851,1539,1540]); +__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 p}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),d=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},p=(0,n.create)()((0,d.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,n,d,o,p)=>{const f=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===n&&'draft'===e.status);if(f){const t={...f,lines:[...f.lines,...d]};return e(e=>({drafts:e.drafts.map(e=>e.id===f.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:n,title:'Supplier shopping list',lines:d,by:o,app:p})},decide:(t,s,n)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:n,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,d.createJSONStorage)(()=>s.default)}))},1539,[824,831,834]); +__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)}))},1540,[824,831,834]); +__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 x}}),Object.defineProperty(_e,"STAFF_ALLOWED",{enumerable:!0,get:function(){return C}});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]),i=r(_d[6]);const h=()=>{try{return(0,e.nowFrom)(e.useStore.getState().clock)}catch{return new Date}},c=e=>String(e).padStart(2,'0'),d=e=>e.getFullYear()+'-'+c(e.getMonth()+1)+'-'+c(e.getDate()),l=e=>{const t=new Date(e);return c(t.getHours())+':'+c(t.getMinutes())},u=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return c(Math.floor(t/60))+':'+c(t%60)},m=(e,t)=>{if(e===t)return'today';const[a,s,o]=e.split('-').map(Number),n=new Date(a,s-1,o),i=new Date(h());return i.setDate(i.getDate()+1),e===d(i)?'tomorrow':n.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})},p=(e,t)=>t.test(e),f=e=>(e??'').replace(' (example)',''),b=e=>t.useOwner.getState().staff.find(t=>t.id===e.whoId),k=['staff'],w=[['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/]],y={all:'the Team chat',kitchen:'Kitchen',foh:'Front of house',managers:'Managers'};function S(e,t){return'all'===e||(0,n.inChannel)(e,t)}function v(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:f(e.name),nickname:e.nickname},o))}const x=[{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=>p(e,/\bkitchen (chat|group|channel)\b/)&&!p(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:h().toISOString()}),'Posted in the Kitchen chat.')},{id:'post_team_chat',apps:k,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=>p(e,/\b(message|pm|dm|text|tell|post|send|let)\b/)&&p(e,/\b(chat|team|everyone|group|kitchen|front of house|managers|know|:)|\b(message|pm|dm|text)\s+[a-z]+\s*[:,]/)&&!p(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=v(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:f(o.name)};const h=w.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 '+(y[String(e.ch)]??'the team chat')+': \u201c'+e.text+'\u201d?',run:(e,a)=>{const s=String(e.ch),o=b(a);return!e.text||String(e.text).length<2?'What should the message say?':s.startsWith('dm:')||S(s,o)?(t.useOwner.getState().chatSend({ch:s,from:String(a.whoId??'system'),text:String(e.text),at:h().toISOString()}),e.to?'Sent to '+e.to+'.':'Posted in '+(y[s]??'the team chat')+'.'):'You can\u2019t post in '+(y[s]??s)+'. Try the Team chat.'}},{id:'read_chat',apps:k,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=>p(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=b(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||S(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),d=e=>'system'===e.from?'CoverCharge':f(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 d(e)+' '+(((t=e.ch).startsWith('dm:')?'privately':'in '+(y[t]??t))+' at ')+l(e.at)+': '+e.text;var t}).join('. '):'No messages yet.'}},{id:'my_shift',apps:k,title:'My next shift or rota',risk:'look',description:'Your next published shift, or your shifts this week.',params:[],keywords:['shift','rota'],match:e=>p(e,/\b(my|next|when am i|am i (on|working|in)|when do i (start|work|finish))\b/)&&p(e,/\b(shifts?|rota|working|on|in|start|finish)\b/)&&!p(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=h(),i=n.getHours()+n.getMinutes()/60,c=o.find(e=>e.date>s||e.end>i)??o[0],d=o.filter(e=>e!==c).slice(0,4);return'Your next shift: '+m(c.date,s)+', '+u(c.start)+' to '+u(c.end)+(c.note?' ('+c.note+')':'')+'.'+(d.length?' Then '+d.map(e=>m(e.date,s)+' '+u(e.start)+'\u2013'+u(e.end)).join(', ')+'.':'')}},{id:'clock_status',apps:k,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=>p(e,/\b(clock(ed)?|clocking)\b/)?6:0,preview:()=>'Clock status',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),n=(0,t.openShiftOf)(s.attendance,String(a.whoId),o),c=a.today,d=o.getHours()+o.getMinutes()/60,m=(0,i.workingShifts)(s.shifts,s.leave).find(e=>e.staffId===a.whoId&&e.published&&e.date===c);return n?'You\u2019re clocked in since '+l(n.in)+'.'+(m?' Your shift ends at '+u(m.end)+'.':'')+' Remember to clock out on the Clock tab when you finish.':m&&m.end>d?'You\u2019re not clocked in. Your shift today is '+u(m.start)+' to '+u(m.end)+'. Clock in on the Clock tab when you start.':'You\u2019re not clocked in.'+(m?'':' You have no shift today.')+' Use the Clock tab to clock in or out.'}},{id:'my_break',apps:k,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=>p(e,/\bbreaks?\b/)?6:0,preview:()=>'Your break',run:(e,a)=>{const s=t.useOwner.getState(),o=h(),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 i=(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 '+l(e.start)+'. Breaks today: '+i+' minutes. Tap End break on the Clock tab when you\u2019re back.'}return i?'You\u2019ve had '+i+' 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:k,title:'Today\u2019s specials',risk:'look',description:'Read out today\u2019s specials board.',params:[],keywords:['specials'],match:e=>p(e,/\bspecials?\b/)&&!p(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:k,title:'What\u2019s sold out',risk:'look',description:'List dishes that are sold out right now.',params:[],keywords:['sold out','86'],match:e=>p(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.'}}],C=new Set(['log_check','allergen_info','next_table_free',...x.filter(e=>e.apps?.includes('staff')).map(e=>e.id)])},1541,[816,876,910,851,1538,1017,1071]); +__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))'},1542,[]); +__d(function(g,_r,_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,u.useVoiceSettings)();return(0,x.jsxs)(n.default,{style:{gap:12},children:[(0,x.jsx)(i.Banner,{kind:"info",title:"Hold to talk",children:"The voice assistant is on The Anchorage\u2019s Display only. Staff hold the gold button at the top right, say what they need and let go. Replies are shown in text. Tap Confirm or Cancel, or say \u201cyes\u201d to confirm. Supplier orders, messages and payments are only saved as drafts."}),(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:u.VOICE_ROLES.map(s=>(0,x.jsx)(i.Toggle,{label:u.VOICE_ROLE_LABEL[s],value:(0,u.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,h.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:p}=(0,f.useCtx)(6e4),u=(0,r.useDrafts)(e=>e.drafts),h=(0,r.useDrafts)(e=>e.decide),c=(0,l.useVoiceNav)(e=>e.go),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(!1),T=u.filter(s=>s.rid===e),B=T.filter(e=>'draft'===e.status),S=T.filter(e=>'draft'!==e.status).slice(0,30),D='owner'===p||'manager'===p,C=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&&D?(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'})}),C(e)?.links?(0,x.jsx)(i.Button,{small:!0,kind:"ghost",label:`Open ${C(e).name} ordering`,onPress:()=>{t.default.openURL(C(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:"Drafts saved earlier (bookings, supplier shopping lists, offers, events, specials, messages and payments) wait 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."}),D?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."}),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:!!v,onClose:()=>y(null),title:'approved'===v?.status?'Approve this draft?':'Dismiss this draft?',children:v?(0,x.jsxs)(n.default,{style:{gap:10},children:[(0,x.jsx)(i.T,{weight:"semibold",children:v.d.title}),(0,x.jsx)(i.T,{size:15,children:'approved'===v.status?`This marks it approved${j[v.d.kind]?` and opens ${j[v.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'===v.status?'success':'danger',label:'approved'===v.status?'Approve':'Dismiss',testID:"draft-confirm",onPress:()=>{h(v.d.id,v.status,o.replace(' (example)',''));const e=j[v.d.kind];y(null),'approved'===v.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,p.useShiftNotes)(e=>e.notes).filter(s=>s.rid===e),t=(0,p.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. 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]),p=_r(_d[8]),u=_r(_d[9]),h=_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 j={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'}}},1543,[17,362,85,777,804,1478,1539,1490,1540,1544,1217,1545,1057,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return s}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(f(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(f(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),s=(e,n,t)=>!1!==e[n]?.[t],f=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1544,[824,831,834]); +__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])},1545,[17,85,777,804,1546,8]); +__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.'},1546,[824,831,834]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1547,[17,779,85,777,845,1260,1548,1549,804,8]); +__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'},1548,[845]); +__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()})},1549,[899,1548,1263]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.NightlyReportPage=function(){const{rid:e,r:l,today:v}=(0,y.useCtx)(6e4),f=(0,r.useBookings)(e),S=(0,o.useCashUp)(e=>e.cashUps),k=(0,o.useCashSettings)(e),w=(0,d.useNightlyPrefs)(s=>s.email[e]??!1),T=(0,d.useNightlyPrefs)(e=>e.setEmail),C=(0,c.useSoldOut)(e=>e.entries).filter(s=>s.rid===e&&s.on).map(e=>e.name),[N,U]=(0,s.useState)((0,u.addDaysYmd)(v,-1)),P=(0,u.cashFieldsForRecord)(k.cashFields,(0,u.cashUpRecordFor)(e,l.settings.cashUpRecord)),R=(0,h.nightlyReport)({rid:e,date:N,bookings:f,cashUps:S,fields:P,soldOut:C}),_='anchorage'!==e&&w,D=[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:D.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:()=>U(e)},e))}),(0,j.jsxs)(n.Card,{style:{alignItems:'center',width:'100%'},children:[(0,j.jsx)(x,{label:"Spend per head",value:R.spendPerHead}),(0,j.jsx)(x,{label:"Covers",value:String(R.covers)}),(0,j.jsx)(x,{label:"No-shows",value:String(R.noShows)}),(0,j.jsx)(x,{label:"Cancellations",value:String(R.cancellations)}),(0,j.jsx)(x,{label:"Takings",value:R.takings}),(0,j.jsx)(x,{label:"Tips",value:R.tips}),(0,j.jsx)(x,{label:"Takings last week",value:R.lastWeekTakings}),(0,j.jsx)(x,{label:"Busiest hour",value:R.busiestHour}),(0,j.jsx)(x,{label:"Sold out",value:R.soldOut.length?R.soldOut.join(', '):'None recorded'}),(0,j.jsx)(n.T,{center:!0,weight:"bold",colour:b.colours.gold,style:{marginTop:8},children:"Cash up"}),R.cashUp.length?R.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:_,onChange:s=>T(e,s)}):null]})};var e,s=_r(_d[0]),l=_r(_d[1]),t=(e=l)&&e.__esModule?e:{default:e},n=_r(_d[2]),r=_r(_d[3]),o=_r(_d[4]),d=_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:s})=>(0,j.jsxs)(t.default,{accessible:!0,accessibilityLabel:`${e}. ${s}`,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:s})]})},1550,[17,85,777,858,1008,1551,891,839,1552,1020,804,1057,8]); +__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}))},1551,[824,831,834]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nightlyReport=function(n){const{rid:o,date:c,bookings:f,cashUps:p,fields:h,soldOut:v}=n,b=f.filter(t=>t.restaurantId===o&&t.date===c),k=p.find(t=>t.rid===o&&t.date===c&&t.confirmedAt),O=p.find(n=>n.rid===o&&n.date===(0,t.addDaysYmd)(c,-7)&&n.confirmedAt),y=k?(0,t.tillTakingsOf)(k.vals):null,N=(0,l.coversOn)(f,o,c),w=null==y||N<=0?null:Math.round(y/N*100)/100,D=new Map;for(const t of b){if(!['seated','finished'].includes(t.status))continue;const n=Number(t.time.slice(0,2));Number.isFinite(n)&&D.set(n,(D.get(n)??0)+(t.partySize||0))}let S=null;for(const[t,n]of D)(!S||n>S.n)&&(S={hour:t,n:n});return{date:c,spendPerHead:s(w),covers:N,noShows:b.filter(t=>'noshow'===t.status).length,cancellations:b.filter(t=>'cancelled'===t.status).length,takings:s(y),tips:s(k?(0,t.combinedTips)(k.vals):null),lastWeekTakings:s(O?(0,t.tillTakingsOf)(O.vals):null),busiestHour:S?`${String(S.hour).padStart(2,'0')}:00 \xb7 ${S.n} Covers`:'Not entered',soldOut:v.filter(Boolean),cashUp:u(k?.vals,h,!!k)}};var t=r(d[0]),n=r(d[1]),l=r(d[2]);const s=t=>null==t?'Not entered':`\xa3${t.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,o=(t,n)=>null==t||''===t?'Not entered':'money'===n&&'number'==typeof t?s(t):String(t);function u(t,l,u){const c=[];for(const f of l){if('paidOut'===f.key){c.push({label:'Paid out',value:u?(0,n.paidOutDetail)(t):'Not entered'});const l=u?(0,n.expectedCashInDrawer)(t):null;c.push({label:'Expected cash in the drawer',value:null==l?'Not entered':s(l)});continue}c.push({label:f.label,value:u&&t?o(t[f.key],f.kind):'Not entered'})}if(u&&t&&!l.some(t=>'paidOut'===t.key)){c.push({label:'Paid out',value:(0,n.paidOutDetail)(t)});const l=(0,n.expectedCashInDrawer)(t);null!=l&&c.push({label:'Expected cash in the drawer',value:s(l)})}return c}},1552,[839,1009,1470]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SupportChatPage=function(){const{r:e,me:f,meId:x}=(0,h.useCtx)(6e4),[j,v]=(0,s.useState)(''),[C,I]=(0,s.useState)(null),[w,S]=(0,s.useState)(!1),[R,D]=(0,s.useState)('idle'),[L,P]=(0,s.useState)(''),[k,B]=(0,s.useState)(''),[_,T]=(0,s.useState)('');(0,s.useEffect)(()=>{(0,p.signedInEmail)().then(B)},[]);const E=async e=>{T('');try{const t=await(0,c.capturePlatingPhoto)(e);t&&(I(t),D(e=>'sent'===e?'idle':e))}catch(e){T(e instanceof Error?e.message:'Could not add that picture.')}},H=async()=>{const t=j.trim();if(!t||w)return;S(!0),P(''),D('idle');const s=await(0,p.writeSupportRequest)({venueName:e.name,body:t,fromName:f.replace(' (example)',''),fromEmail:k,staffRef:x||'',appVersion:u.APP_VERSION,photoDataUrl:C?.dataUrl??null});if(S(!1),s.ok)return v(''),I(null),D('sent'),void P(b);D('error'),P(s.message)};return(0,y.jsxs)(l.default,{testID:"customer-support",style:{gap:12,alignItems:'center',width:'100%',paddingBottom:8},children:[(0,y.jsx)(o.T,{center:!0,weight:"bold",colour:n.colours.gold,accessibilityRole:"header",children:"Customer support"}),(0,y.jsx)(o.Muted,{center:!0,children:"Send a message to CoverCharge. You can attach one picture, such as a photo or a screenshot. We'll reply by email."}),'sent'===R?(0,y.jsx)(l.default,{testID:"support-sent",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"polite",accessibilityLabel:b,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"success",title:b})}):null,'error'===R?(0,y.jsx)(l.default,{testID:"support-error",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:L,style:{width:'100%'},children:(0,y.jsx)(o.Banner,{kind:"danger",title:L})}):null,(0,y.jsx)(t.TextInput,{testID:"support-message",accessibilityLabel:"Your message to CoverCharge",value:j,onChangeText:e=>{v(e),'sent'===R&&D('idle')},placeholder:"Write your message",placeholderTextColor:n.colours.muted,multiline:!0,style:{width:'100%',minHeight:120,borderWidth:1,borderColor:n.colours.border,borderRadius:12,padding:12,color:n.colours.text,textAlign:'center'}}),C?(0,y.jsxs)(l.default,{testID:"support-photo-preview",style:{alignItems:'center',width:'100%',gap:8},children:[(0,y.jsx)(r.default,{source:{uri:C.dataUrl},style:{width:240,height:180,borderRadius:12,backgroundColor:n.colours.surface2},accessibilityLabel:"Attached picture preview"}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Remove picture",accessibilityLabel:"Remove the attached picture",testID:"support-photo-remove",onPress:()=>I(null),style:{minHeight:48}})]}):(0,y.jsxs)(l.default,{style:{width:'100%',gap:8,alignItems:'center'},children:[(0,y.jsx)(o.Button,{kind:"secondary",label:"Take a photo",accessibilityLabel:"Take a photo to attach",testID:"support-photo-camera",onPress:()=>{E('camera')},style:{minHeight:48,width:'100%'}}),(0,y.jsx)(o.Button,{kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a picture or screenshot from your gallery",testID:"support-photo-gallery",onPress:()=>{E('library')},style:{minHeight:48,width:'100%'}})]}),_?(0,y.jsx)(o.Muted,{center:!0,testID:"support-photo-error",children:_}):null,(0,y.jsx)(o.Button,{testID:"support-send",label:"Send to CoverCharge",accessibilityLabel:"Send to CoverCharge",disabled:!j.trim()||w,onPress:()=>{H()},style:{minHeight:56,width:'100%'}}),w?(0,y.jsx)(l.default,{accessibilityLiveRegion:"polite",style:{width:'100%'},children:(0,y.jsx)(o.Muted,{center:!0,testID:"support-sending",children:"Sending\u2026"})}):null]})};var t=_r(d[0]),s=_r(d[1]),r=e(_r(d[2])),l=e(_r(d[3])),o=_r(d[4]),n=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),y=_r(d[10]);const b="Sent. We'll reply by email."},1553,[812,17,319,85,777,804,1082,978,1554,1057,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPPORT_BUCKET",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SUPPORT_SEND_FAILED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SUPPORT_SIGN_IN",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SUPPORT_NO_EMAIL",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SUPPORT_PHOTO_FAILED",{enumerable:!0,get:function(){return l}}),e.writeSupportMessage=async function(o){if(!t.RELEASE.supportSync)return{ok:!1,message:n.SUPPORT_NOT_SENT};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:n.SUPPORT_NOT_SENT};const c=u.useSync.getState().venueId;if(!c)return{ok:!1,message:`${n.SUPPORT_NOT_SENT} Sign in and try again.`};try{const t=(0,i.getSupabase)(),{error:s}=await t.from('support_messages').insert({venue_id:c,body:o.text,from_name:o.from,staff_ref:o.staffRef||null});return s?{ok:!1,message:n.SUPPORT_NOT_SENT}:{ok:!0}}catch{return{ok:!1,message:n.SUPPORT_NOT_SENT}}},e.writeSupportRequest=async function(t){if('undefined'!=typeof globalThis&&globalThis.__CC_SUPPORT_FAKE_SEND)return{ok:!0,id:'preview-test',emailed:!0};const n=t.body.trim().slice(0,4e3),S=t.fromName.trim().slice(0,80),y=t.fromEmail.trim().slice(0,254),P=t.venueName.trim().slice(0,120);if(!n||!S||!P)return{ok:!1,message:f};if(!y||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(y))return{ok:!1,message:m};if(!(0,s.isSupabaseConfigured)())return{ok:!1,message:p};const b=u.useSync.getState().venueId;if(!b)return{ok:!1,message:p};const T=globalThis.crypto?.randomUUID?.()??`00000000-0000-4000-8000-${Date.now().toString(16).padStart(12,'0')}`,O=(0,i.getSupabase)();let h=null;if(t.photoDataUrl)try{const n=_(t.photoDataUrl);h=`${b}/${T}.jpg`;const{error:o}=await O.storage.from(c).upload(h,n,{contentType:'image/jpeg',upsert:!1});if(o)return{ok:!1,message:l}}catch{return{ok:!1,message:l}}const E={id:T,venue_id:b,venue_name:P,body:n,from_name:S,from_email:y,staff_ref:t.staffRef||null,app_version:(t.appVersion||o.APP_VERSION).slice(0,40),photo_path:h},{error:N}=await O.from('support_requests').insert(E);if(N)return{ok:!1,message:f};let U=!1;try{const t=await O.functions.invoke('send-support-email',{body:{request_id:T}}),n=t.data;U=!t.error&&!!n?.sent}catch{U=!1}return{ok:!0,id:T,emailed:U}},e.signedInEmail=async function(){if(!(0,s.isSupabaseConfigured)())return'';try{const{data:t}=await(0,i.getSupabase)().auth.getUser();return(t.user?.email??'').trim()}catch{return''}};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),i=r(d[4]),u=r(d[5]);const c='support-photos',f='Could not send. Check your connection and try again.',p='Could not send. Sign in and try again.',m='Your sign-in has no email. Sign in again and try again.',l='Could not attach the picture. Try a smaller photo, or send without a picture.';function _(t){const n=/^data:([^;]+);base64,(.+)$/.exec(t);if(!n)throw new Error('bad picture');const o=atob(n[2]),s=new Uint8Array(o.length);for(let t=0;t{x(!0),y('');const e=await(0,l.makeChromeHandover)();if(x(!1),!e.ok)return y(e.message),void k(e.message);const o='undefined'!=typeof window&&(0,u.desktopLinkFor)(window.location.href,e.code)||'';n({link:o,code:e.code}),k('Sign-in link made. It works once, for 10 minutes. Share it or copy it next.')},testID:"uoc-make"}),e?(0,p.jsxs)(t.default,{style:{gap:8,padding:14,borderRadius:12,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface},children:[(0,p.jsx)(r.Button,{label:"Share or copy the link",onPress:async()=>{if(!e)return;const o='undefined'!=typeof navigator?navigator:null;if(o?.share&&e.link)try{return void await o.share({title:'CoverCharge for desktop',text:'Sign in to CoverCharge for desktop (works once, for 10 minutes)',url:e.link})}catch{}const n=e.link&&await(0,h.copyText)(e.link)?'Link copied. Paste it into a message to yourself, then open it on the computer.':'Couldn\u2019t copy. Read the code below and type it on the computer instead.';y(n),k(n)},testID:"uoc-share"}),(0,p.jsx)(r.T,{size:13,colour:c.colours.muted,center:!1,children:"Or type this code on the computer:"}),(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-code",accessibilityLabel:`Code: ${(0,u.codeGroups)(e.code).split('').join(' ')}`,style:{fontSize:20,fontWeight:'700',color:c.colours.goldLight,letterSpacing:1},children:(0,u.codeGroups)(e.code)}),e.link?(0,p.jsx)(s.Text,{selectable:!0,testID:"uoc-link",style:{fontSize:12,color:c.colours.muted},children:e.link}):null]}):null,(0,p.jsx)(t.default,{accessibilityLiveRegion:"polite",children:f?(0,p.jsx)(r.T,{size:14,center:!1,colour:/Couldn|Sign in|Too many|connection/i.test(f)?c.colours.red:c.colours.text,children:f}):null})]})};var o=_r(d[0]),n=e(_r(d[1]));_r(d[2]);var t=e(_r(d[3])),r=_r(d[4]),s=_r(d[5]),c=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]);const k=e=>{try{n.default.announceForAccessibility(e)}catch{}}},1555,[17,264,219,85,777,812,804,899,1431,1188,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ccDesktop",{enumerable:!0,get:function(){return o}}),e.isDesktop=function(){if(!t())return!1;if(o())return!0;try{const o=new URLSearchParams(t().location?.search??'');return'1'===o.get('desktop')?(t().localStorage?.setItem('cc-desktop','1'),!0):'0'===o.get('desktop')?(t().localStorage?.removeItem('cc-desktop'),!1):'1'===t().localStorage?.getItem('cc-desktop')}catch{return!1}},Object.defineProperty(e,"isMac",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CMD",{enumerable:!0,get:function(){return n}}),r(d[0]);const t=()=>'undefined'!=typeof window?window:void 0,o=()=>t()?.ccDesktop;const c=()=>!!o()?.mac||/Mac/i.test(t()?.navigator?.platform??''),n=()=>c()?'\u2318':'Ctrl+'},1556,[219]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DESKTOP_MIN_WIDTH",{enumerable:!0,get:function(){return j}}),_e.DesktopGate=function({phone:e}){const{width:x}=(0,n.default)(),y=(0,c.useSignedIn)(),{rid:w,role:_}=(0,c.useCtx)(6e4),b=y?(0,c.authorityRole)(y):_;return(y||t.PITCH)&&(0,f.desktopAllowed)(b)?xt.who.includes(e)&&(!t.page||s(t.page)))},Object.defineProperty(_e,"DESKTOP_ROLES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"desktopAllowed",{enumerable:!0,get:function(){return n}}),_e.shortcutIndex=function(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return null;const t=/^Digit([0-9])$/.exec(e.code??'');if(!t)return null;const s=Number(t[1]);return 0===s?9:s-1},Object.defineProperty(_e,"shortcutLabel",{enumerable:!0,get:function(){return o}}),_e.commandKey=function(e,t){const s=(e.key??'').toLowerCase();return!e.ctrlKey&&!e.metaKey||e.altKey||'k'!==s?'escape'===s?'escape':t||e.ctrlKey||e.metaKey||e.altKey?null:'?'===e.key?'help':'/'===e.key?'filter':null:'find'},Object.defineProperty(_e,"SHORTCUTS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"SETTINGS_GROUPS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"OWNER_SETTINGS",{enumerable:!0,get:function(){return u}}),_e.deskCopy=function(e){let t=e;for(const[e,s]of c)t=t.replace(e,s);return t};const e=['owner','manager'],t=[{id:'home',label:'Home',sub:'Today at a glance: Covers, bookings to confirm, takings and GP',who:e},{id:'bookings',label:'Bookings',sub:'Every booking in a wide table: sort, filter and export, or the day view',who:e},{id:'orders',label:'Orders',sub:'Takeaway and table orders',who:e},{id:'forecast',label:'Forecast',sub:'Covers forecast for the days ahead',who:e},{id:'takings',label:'Takings & cash-up',sub:'Cash ups, weekly sales, takings and tips charts',page:'cashup',who:e},{id:'hours',label:'Hours & rota',sub:'Clocked hours in a wide table, sign-off, the rota and payroll hours',who:e},{id:'staff',label:'Staff & roles',sub:'The team, roles, sign-in links and access switches',page:'staff',who:e},{id:'permissions',label:'Permissions',sub:'Saved on the server for the whole team. Only owners can change them',page:'setup-permissions',who:e},{id:'stock',label:'Stock, deliveries & GP',sub:'Scan or type deliveries, count stock, dish GP and GP over time',page:'kitchencosts',who:e},{id:'vouchers',label:'Gift vouchers',sub:'Website vouchers: search, use-by dates, mark as used',page:'vouchers',who:e},{id:'reviews',label:'Reviews',sub:'Read reviews, publish or remove with a recorded reason',page:'reviews',who:e},{id:'settings',label:'Settings',sub:'Venue, hours, booking, pay, Display and app settings',who:e},{id:'chat',label:'Chat',sub:'Staff chat',who:e}];const s=['owner'],n=e=>s.includes(e);const o=(e,t)=>e>9?'':`${t?'\u2325':'Alt+'}${9===e?0:e+1}`;const i=e=>[[e?'\u23251 to \u23250':'Alt+1 to Alt+0','Open the first ten Menu buttons (Rota is 1)'],[e?'\u2318K':'Ctrl+K','Find any page by name'],['/','Jump to the filter box on a table'],['?','Show this list'],['Esc','Close a popup or this list'],['Tab, Shift+Tab','Move between buttons, links and boxes'],['Enter or Space','Press the button, or sort a table column']],l=['Settings','Manage app','Run the day','Team','Compliance','Grow','Start here','Account'],u=['menu','info','tableplan','tables','bookingsettings','staff','payroll','paysettings','haccp','kitchencosts','trackedstock','suppliers','branding','notifications','alerts','displays','displaysettings','connections','giftcards','vouchers','reviewemail','assistantsettings','advanced'],c=[[/\bWix\b/g,'the website'],[/\b(Booker|Bidfood|Brakes)\b/g,'supplier'],[/\bAlsons \(drinks\)/g,'Drinks supplier'],[/\bAlsons\b/g,'the drinks supplier'],[/\bSpes Bona\b/g,'the deli supplier'],[/the the /gi,'the ']]},1558,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.OwnersDesktop=function(){const{rid:e,role:s,today:o,now:u,me:h}=(0,B.useCtx)(3e4),b=(0,B.useSignedIn)(),{width:te,height:se}=(0,a.default)(),[oe,ne]=(0,t.useState)(null),[re,ie]=(0,t.useState)(!1),[le,ae]=(0,t.useState)(!1),[de,ce]=(0,t.useState)(''),[ue,ge]=(0,t.useState)(!1),[he,pe]=(0,t.useState)(!1),[be,fe]=(0,t.useState)(!1),[me,xe]=(0,t.useState)(!1),ke=(0,t.useRef)(null),ye=(0,t.useRef)(null),je=(0,t.useRef)(null),we=(0,t.useRef)(null);(0,t.useEffect)(()=>{if('undefined'==typeof document)return;const e=document.createElement('style');return e.id='cc-owner-desktop-css',e.textContent="\n[data-testid=\"owners-desktop\"] :focus-visible {outline:3px solid #E2C489!important;outline-offset:3px!important;}\n[data-testid=\"owners-desktop\"] ::selection {background:#CFA45F;color:#0B0B0B;}\n[data-testid=\"owners-desktop\"] * {scrollbar-color:#887047 #171511;scrollbar-width:thin;}\n[data-testid=\"desk-skip\"] {position:absolute!important;left:50%;transform:translateX(-50%);top:-100px;z-index:99;background:#CFA45F!important;color:#0B0B0B!important;padding:10px 16px;border-radius:8px;}\n[data-testid=\"desk-skip\"]:focus {top:8px;}\n@media(prefers-reduced-motion:reduce){[data-testid=\"owners-desktop\"] *,[data-testid=\"owners-desktop\"] *:before,[data-testid=\"owners-desktop\"] *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}}\n",document.head.appendChild(e),()=>{e.remove()}},[]),(0,S.useTipsPosted)(e,o),(0,D.useSoldOutLink)(!0,(b?.name??h).replace(' (example)','')),(0,t.useEffect)(()=>{(0,B.ensureAttendance)(o,u),(0,M.ensureChat)(u)},[o]),(0,t.useEffect)(()=>{globalThis.__ccNow=u.getTime()},[u]);const Ce=(0,K.useTakingsAllowed)(s),ve=(0,t.useCallback)(e=>{const t=(0,A.pageFor)(e);return!!t&&(!t.can||t.can(s))},[s]),De=(0,t.useMemo)(()=>(0,V.buttonsFor)({takings:Ce,pageOk:ve}),[Ce,ve]),Ie=oe?(0,V.tabsFor)(oe.btn,{takings:Ce,pageOk:ve}):[],Se=(0,t.useCallback)((e,t)=>{const s=(0,V.tabsFor)(e,{takings:Ce,pageOk:ve});s.length&&(ie(!1),ae(!1),ce(''),ne({btn:e,tab:t&&s.some(e=>e.id===t)?t:s[0].id,page:null}))},[Ce,ve]),Te=De.find(e=>'settings'===e.id),Re=(0,t.useCallback)(e=>{const t=De.find(t=>t.pages.some(t=>t.id===e));t?Se(t,e):Te&&ve(e)&&(ie(!1),ae(!1),ce(''),ne({btn:Te,tab:'@desk-settings',page:e}))},[De,Se,Te,ve]),Oe=(0,t.useCallback)((e,t)=>{if('home'!==e)if('more'===e&&t)Re(t);else{if('bookings'===e){const e=De.find(e=>'bookings'===e.id);return void(e&&Se(e,'@bookings'))}if('chat'===e){const e=De.find(e=>'chat'===e.id);return void(e&&Se(e))}'orders'!==e&&'forecast'!==e?'more'===e&&Te&&Se(Te):ne(t=>({btn:t?.btn??De[0],tab:'orders'===e?'@orders':'@forecast',page:null}))}else ne(null)},[De,Se,Re,Te]);(0,t.useEffect)(()=>(T.useVoiceNav.setState({go:Oe}),()=>T.useVoiceNav.setState({go:null})),[Oe]),(0,C.useAlertWatcher)(e,{nag:!0}),(0,v.useReviewAlerts)(e),(0,w.useScheduledNotices)({rid:e,staffId:b?.id??'',name:h,onOpen:e=>'bookings'===e?Oe('bookings'):'chat'===e?Oe('chat'):Oe('more',e)}),(0,j.useOffRotaAlerts)({enabled:!!b});const Pe=!oe||De.some(e=>e.id===oe.btn.id)&&Ie.some(e=>e.id===oe.tab)&&(!oe.page||ve(oe.page));(0,t.useEffect)(()=>{if(!Pe){const e=setTimeout(()=>ne(null),0);return()=>clearTimeout(e)}},[Pe]);const Le=oe?.page?(0,A.pageFor)(oe.page):void 0,We=oe?(0,_.deskCopy)(Le?.title??oe.btn.label):'Floor plan';(0,t.useEffect)(()=>{if('undefined'!=typeof document&&(document.title=`${We} \xb7 The Anchorage \xb7 CoverCharge for desktop`),we.current?.scrollTo?.({y:0,animated:!1}),oe){const e=setTimeout(()=>Y(je.current),80);return()=>clearTimeout(e)}},[We,oe?.tab,oe?.page]),(0,t.useEffect)(()=>{if(le){const e=setTimeout(()=>ke.current?.focus?.(),100);return()=>clearTimeout(e)}},[le]),(0,t.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{if(e.defaultPrevented||e.isComposing)return;const t=q(e.target),s=(0,_.commandKey)(e,t);if('escape'===s){if(le||ue||he||be)return e.preventDefault(),ae(!1),ge(!1),pe(!1),void fe(!1);if(document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;return re?(e.preventDefault(),void ie(!1)):void(oe&&(e.preventDefault(),ne(null)))}if(le||ue||he||be||document.querySelector('[role="dialog"]:not([data-testid="desk-menu-panel"])'))return;if('find'===s)return e.preventDefault(),ie(!1),void ae(!0);if('help'===s)return e.preventDefault(),void ge(!0);if('filter'===s&&ye.current&&oe)return e.preventDefault(),void ye.current?.focus?.();const o=t?null:(0,_.shortcutIndex)(e);null!=o&&De[o]&&(e.preventDefault(),Se(De[o]))};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[le,ue,he,be,re,oe,De,Se]),(0,t.useEffect)(()=>{if(R.PITCH)return globalThis.__pitchGo=Oe,globalThis.__deskOpen=(e,t)=>{const s=De.find(t=>t.id===e);s&&Se(s,t)},globalThis.__deskRole=e=>I.useOwner.getState().setPreviewRole(e),()=>{delete globalThis.__deskOpen,delete globalThis.__deskRole}},[Oe,De,Se]);const Be=(0,t.useMemo)(()=>{const e=de.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De.flatMap(e=>(0,V.tabsFor)(e,{takings:Ce,pageOk:ve}).map(t=>({key:`t-${e.id}-${t.id}`,title:t.label===e.label?e.label:`${e.label}: ${t.label}`,sub:e.hint,run:()=>Se(e,t.id)}))),o=new Set(De.flatMap(e=>e.pages.map(e=>e.id)));return[...t,...A.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(s))&&!o.has(e.id)).map(e=>({key:`p-${e.id}`,title:(0,_.deskCopy)(e.title),sub:(0,_.deskCopy)(e.sub??''),run:()=>Re(e.id)}))].filter(t=>e.every(e=>`${t.title} ${t.sub}`.toLowerCase().includes(e)))},[de,De,s,Ce,ve,Se,Re]),He=(0,N.ddmmyyyy)(o),Me=u.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}),Ee=b?(0,B.authorityRole)(b):s,$e=(b?.name??h).replace(' (example)',''),ze='owner'===Ee?b?.ownerAccess&&'owner'!==b.role?'Owner access':'Owner':'Manager',Ae=e=>(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1280,alignSelf:'center'},children:e}),Fe=e=>{const t=(0,A.pageFor)(e);return!t||t.can&&!t.can(s)?(0,X.jsx)(f.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,X.jsx)(l.default,{style:{width:'100%',maxWidth:1100,alignSelf:'center'},children:(0,X.jsx)(t.C,{go:Oe})})};return(0,X.jsxs)(c.SafeAreaView,{testID:"owners-desktop",style:{flex:1,backgroundColor:P.colours.bg},children:[(0,X.jsx)(n.default,{accessibilityRole:"link",testID:"desk-skip",onPress:()=>oe?Y(je.current):ie(!0),children:(0,X.jsx)(f.T,{weight:"bold",colour:P.colours.onGold,children:oe?'Skip to main content':'Open the owner tools menu'})}),(0,X.jsxs)(l.default,{testID:"desk-board",role:"main",'aria-label':'Floor plan, live',style:{flex:1,minHeight:0,width:'100%'},children:[(0,X.jsx)(L.DisplayBoard,{embedded:!0,noVoice:!0,boardW:te,headerExtra:(0,X.jsx)(J,{open:re,onPress:()=>ie(!0)}),subHeader:(0,X.jsx)(Q,{name:$e,access:ze,day:He,at:Me})}),oe&&Pe?(0,X.jsxs)(l.default,{testID:"desk-panel",style:{position:'absolute',top:0,bottom:0,left:0,right:0,zIndex:40,backgroundColor:P.colours.bg},children:[(0,X.jsxs)(l.default,{testID:"desk-panel-head",role:"banner",style:{flexDirection:'row',alignItems:'center',gap:10,paddingHorizontal:16,paddingVertical:10,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-start'},children:(0,X.jsx)(n.default,{testID:"desk-panel-close",accessibilityRole:"button",accessibilityLabel:oe.page?'Back to all settings':`Close ${oe.btn.label}, back to the floor plan`,onPress:()=>oe.page?ne({...oe,page:null}):ne(null),style:({hovered:e,focused:t})=>({minHeight:48,paddingHorizontal:16,borderRadius:14,borderWidth:1,borderColor:e||t?P.colours.gold:P.colours.border,alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:oe.page?'\u2039 All settings':'\u2039 Floor plan'})})}),(0,X.jsxs)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,X.jsx)(l.default,{ref:je,role:"heading",'aria-level':1,tabIndex:-1,nativeID:"desk-page-title",testID:"desk-page-title",style:{outlineStyle:'none'},children:(0,X.jsx)(f.T,{size:24,weight:"bold",colour:P.colours.gold,center:!0,numberOfLines:1,children:We})}),(0,X.jsx)(f.T,{size:12,colour:P.colours.muted,center:!0,numberOfLines:1,children:(0,_.deskCopy)(Le?.sub??oe.btn.hint)})]}),(0,X.jsx)(l.default,{style:{width:210,alignItems:'flex-end'},children:(0,X.jsx)(J,{testID:"desk-menu-button-page",open:re,onPress:()=>ie(!0)})})]}),Ie.length>1&&!oe.page?(0,X.jsx)(l.default,{testID:"desk-panel-tabs",role:"tablist",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:Ie.map(e=>{const t=e.id===oe.tab;return(0,X.jsx)(n.default,{testID:`desk-tab-${e.id.replace(/^@(desk-)?/,'')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>ne({btn:oe.btn,tab:e.id,page:null}),style:({hovered:e,focused:s})=>({minHeight:44,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t||s?P.colours.gold:P.colours.border,backgroundColor:t?Z:e?P.colours.tilePressed:'transparent',alignItems:'center',justifyContent:'center'}),children:(0,X.jsx)(f.T,{weight:"semibold",colour:t?P.colours.goldLight:P.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,X.jsx)(i.default,{ref:we,testID:"desk-main",'aria-labelledby':'desk-page-title',style:{flex:1,minHeight:0},contentContainerStyle:{padding:22,gap:16,paddingBottom:48,width:'100%',maxWidth:1400,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(()=>{if(!oe||!Pe)return null;if(oe.page)return Fe(oe.page);switch(oe.tab){case'@desk-bookings':return(0,X.jsx)(K.DesktopBookings,{filterRef:ye});case'@desk-hours':return(0,X.jsx)(K.DesktopHours,{go:Oe,filterRef:ye});case'@desk-takings':return Ce?(0,X.jsx)(K.DesktopTakings,{go:Oe}):(0,X.jsx)(f.Muted,{center:!0,children:"Takings aren\u2019t available for your role."});case'@desk-settings':return(0,X.jsx)(K.DesktopSettings,{open:e=>ne(t=>t?{...t,page:e}:t)});case'@desk-permissions':return(0,X.jsx)(G.DeskPermissions,{});case'@desk-leavers':return(0,X.jsx)(G.DeskLeavers,{});case'@desk-temps':return Ae((0,X.jsx)(G.DeskTemps,{}));case'@desk-bookinghistory':return Ae((0,X.jsx)(G.DeskCoversHistory,{}));case'@bookings':return(0,X.jsx)(H.Bookings,{go:Oe});case'@chat':return(0,X.jsx)(M.Chat,{go:Oe});case'@noshows':return Ae((0,X.jsx)(W.NoShows,{go:Oe}));case'@orders':return(0,X.jsx)($.Orders,{});case'@forecast':return(0,X.jsx)(E.Forecasts,{go:Oe});default:return Fe(oe.tab)}})()})]}):null]}),(0,X.jsx)(ee,{visible:re,buttons:De,current:oe?.btn.id,W:te,H:se,onClose:()=>ie(!1),onPick:e=>Se(e),onFind:()=>{ie(!1),ae(!0)},onKeys:()=>{ie(!1),ge(!0)},onInstall:()=>{ie(!1),pe(!0)},onSignOut:()=>{ie(!1),fe(!0)}}),le?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ae(!1),title:"Find a page",maxWidth:640,testID:"desk-search",children:[(0,X.jsx)(p.TextInput,{ref:ke,value:de,onChangeText:ce,placeholder:"Name of a page or what you want to do",accessibilityLabel:"Find a page",style:[f.styles.input,{fontSize:15,textAlign:'center'}],placeholderTextColor:P.colours.muted,testID:"desk-search-input"}),(0,X.jsx)(l.default,{'aria-live':'polite',children:(0,X.jsxs)(f.Muted,{center:!0,children:[Be.length," pages"]})}),Be.slice(0,60).map(e=>(0,X.jsxs)(n.default,{accessibilityRole:"button",onPress:e.run,style:({hovered:e})=>({padding:12,borderWidth:1,borderColor:P.colours.border,borderRadius:9,backgroundColor:e?P.colours.tilePressed:P.colours.surface}),children:[(0,X.jsx)(f.T,{weight:"semibold",center:!0,children:e.title}),(0,X.jsx)(f.Muted,{center:!0,children:e.sub})]},e.key))]}):null,ue?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>ge(!1),title:"Keyboard shortcuts",maxWidth:600,testID:"desk-shortcuts",children:[(0,_.SHORTCUTS)((0,F.isMac)()).map(([e,t])=>(0,X.jsxs)(l.default,{style:{alignItems:'center',paddingVertical:4},children:[(0,X.jsx)(f.T,{weight:"semibold",colour:P.colours.goldLight,center:!0,children:e}),(0,X.jsx)(f.T,{center:!0,children:t})]},e)),(0,X.jsx)(f.Muted,{center:!0,children:"Alt 1 to 0 open the first ten Menu buttons (Rota is 1). Option is the Alt key on a Mac. Esc closes the menu, then the open screen. Screen-reader users can use the headings and landmarks, or Tab through."})]}):null,be?(0,X.jsxs)(f.Sheet,{visible:!0,onClose:()=>fe(!1),title:"Sign out of this computer?",maxWidth:560,testID:"desk-signout-sheet",children:[(0,X.jsx)(f.Muted,{center:!0,children:"This signs CoverCharge out in this browser (the desktop and the Managers web app on this computer). Your phone stays signed in. To come back, make a new sign-in link on your phone."}),(0,X.jsxs)(f.Row,{gap:10,style:{justifyContent:'center',marginTop:12},children:[(0,X.jsx)(f.Button,{kind:"secondary",label:"Cancel",onPress:()=>fe(!1),testID:"desk-signout-cancel"}),(0,X.jsx)(f.Button,{label:me?'Signing out\u2026':'Sign out',disabled:me,onPress:async()=>{xe(!0),await(0,O.wipeThisDevice)({reload:!0})},testID:"desk-signout-go"})]})]}):null,he?(0,X.jsx)(f.Sheet,{visible:!0,onClose:()=>pe(!1),title:"Install CoverCharge for desktop",maxWidth:680,testID:"desk-install-sheet",children:(0,X.jsx)(U.DesktopInstallPage,{})}):null,(0,X.jsx)(k.SeatAllergenReminder,{rid:e}),(0,X.jsx)(x.PrintHost,{rid:e}),(0,X.jsx)(m.AlertHost,{variant:"managers",rid:e,me:h,onOpen:e=>Oe('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}),(0,X.jsx)(z.OnboardingHost,{go:Oe}),(0,X.jsx)(y.CoachHost,{})]})};var t=r(d[0]),s=e(r(d[1])),o=e(r(d[2]));r(d[3]);var n=e(r(d[4])),i=e(r(d[5])),l=e(r(d[6])),a=e(r(d[7])),c=r(d[8]),u=r(d[9]),h=e(u),p=r(d[10]),b=r(d[11]),f=r(d[12]),m=r(d[13]),x=r(d[14]),k=r(d[15]),y=r(d[16]),j=r(d[17]),w=r(d[18]),C=r(d[19]),v=r(d[20]),D=r(d[21]),I=r(d[22]),S=r(d[23]),T=r(d[24]),R=r(d[25]),O=r(d[26]),P=r(d[27]),L=r(d[28]),W=r(d[29]),B=r(d[30]),H=r(d[31]),M=r(d[32]),E=r(d[33]),$=r(d[34]),z=r(d[35]),A=r(d[36]);r(d[37]);var F=r(d[38]),_=r(d[39]),V=r(d[40]),N=r(d[41]),K=r(d[42]),G=r(d[43]),U=r(d[44]),X=r(d[45]);const q=e=>/^(INPUT|TEXTAREA|SELECT)$/.test(e?.tagName??'')||!!e?.isContentEditable,Y=e=>{if(!e)return;const t=e.getScrollableNode?.()??e;t?.focus?.()},Z='rgba(201,162,74,0.14)';function J({onPress:e,open:t,testID:s="desk-menu-button"}){return(0,X.jsxs)(n.default,{testID:s,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner tools: Rota, Bookings, Historical data, Staff leaving, Permissions, Settings and more",accessibilityState:{expanded:t},'aria-haspopup':'dialog',onPress:e,style:({pressed:e,hovered:s})=>({height:52,paddingHorizontal:16,borderRadius:26,borderWidth:1.5,borderColor:P.colours.gold,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t||s?P.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:[(0,X.jsx)(h.default,{width:22,height:22,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,X.jsx)(u.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:P.colours.gold},`${t}-${e}`)))}),(0,X.jsx)(f.T,{size:16,weight:"semibold",colour:P.colours.gold,center:!0,children:"Menu"})]})}function Q({name:e,access:t,day:s,at:o}){const n=(0,I.useOwner)(e=>e.attendance),i=(0,I.useOwner)(e=>e.staff),{now:a}=(0,B.useCtx)(3e4),c=a.getTime(),u=[...new Set(n.filter(e=>e.in&&!e.out&&c-new Date(e.in).getTime()<72e6&&c>=new Date(e.in).getTime()).map(e=>(i.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean))];return(0,X.jsxs)(l.default,{testID:"desk-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:14,paddingHorizontal:12,paddingVertical:4,minHeight:40,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.T,{size:14,weight:"semibold",colour:P.colours.goldLight,center:!0,numberOfLines:1,children:u.length?`On now: ${u.join(' \xb7 ')}`:'Nobody clocked in'}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,children:`${s} \xb7 ${o} UK`}),(0,X.jsx)(f.T,{size:13,colour:P.colours.muted,center:!0,testID:"desk-who",children:`Signed in: ${e} \xb7 ${t}`})]})}function ee({visible:e,buttons:a,current:c,onClose:u,onPick:h,onFind:p,onKeys:m,onInstall:x,onSignOut:k,W:y,H:j}){const w=(0,V.deskMenuSizes)(y,j),[C,v]=(0,t.useState)(0),D=C?Math.floor((C-2*w.pad)/w.rows):w.per,I=Math.max(44,Math.min(w.circle,D-2*w.lineH-14)),S={...w,per:Math.min(D,I+2*w.lineH+56),circle:I,icon:Math.round(.44*I)},[T]=(0,t.useState)(()=>new s.default.Value(0)),[R,O]=(0,t.useState)(e),L=(0,t.useRef)(null);if((0,t.useEffect)(()=>{const t=e?setTimeout(()=>O(!0),0):void 0;s.default.timing(T,{toValue:e?1:0,duration:e?190:150,easing:o.default.out(o.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&O(!1)});const n=e?setTimeout(()=>Y(L.current),120):void 0;return()=>{clearTimeout(t),clearTimeout(n)}},[e,T]),!R)return null;const W=T.interpolate({inputRange:[0,1],outputRange:[.35*S.panelW,0]}),B=(0,F.isMac)();return(0,X.jsxs)(l.default,{testID:"desk-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,X.jsx)(s.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:T,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,X.jsx)(n.default,{testID:"desk-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:u,style:{flex:1}})}),(0,X.jsxs)(s.default.View,{testID:"desk-menu-panel",accessibilityViewIsModal:!0,role:"dialog",'aria-modal':!0,'aria-label':'Owner tools',style:{position:'absolute',top:0,bottom:0,right:0,width:S.panelW,opacity:T,transform:[{translateX:W}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:P.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,X.jsxs)(l.default,{style:{height:S.head,flexDirection:'row',alignItems:'center',paddingHorizontal:14,borderBottomWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(l.default,{style:{width:56}}),(0,X.jsx)(l.default,{style:{flex:1,minWidth:0,alignItems:'center'},children:(0,X.jsx)(f.T,{size:21,weight:"semibold",colour:P.colours.gold,accessibilityRole:"header",center:!0,children:"Owner tools"})}),(0,X.jsx)(b.GoldClose,{testID:"desk-menu-close",label:"Close menu",size:"lg",onPress:u})]}),(0,X.jsx)(i.default,{style:{flex:1},contentContainerStyle:{flexGrow:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:S.pad},testID:"desk-menu-grid",onLayout:e=>v(Math.round(e.nativeEvent.layout.height)),children:a.map((e,t)=>{const s=c===e.id,o=(0,V.deskShortcut)(t,B);return(0,X.jsxs)(n.default,{ref:0===t?L:void 0,testID:`desk-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e.label}${s?', open':''}. ${e.hint}${o?`. ${B?'Option':'Alt'} ${9===t?0:t+1}`:''}`,'aria-keyshortcuts':t<10?`Alt+${9===t?'0':t+1}`:void 0,onPress:()=>h(e),style:({pressed:e,hovered:t,focused:s})=>({width:S.colW,height:S.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e||t||s?'rgba(207,164,95,0.10)':'transparent'}),children:[(0,X.jsx)(l.default,{style:{width:S.circle,height:S.circle,borderRadius:S.circle/2,borderWidth:1.5,borderColor:e.extra?P.colours.goldLight:P.colours.gold,backgroundColor:s?P.colours.gold:Z,alignItems:'center',justifyContent:'center'},children:(0,X.jsx)(G.DeskGlyph,{name:e.icon,size:S.icon,colour:s?'#0B0B0B':P.colours.goldLight})}),(0,X.jsx)(f.T,{size:S.label,weight:s?'semibold':'medium',colour:s?P.colours.goldLight:P.colours.text,center:!0,numberOfLines:2,style:{lineHeight:S.lineH,maxWidth:S.colW-6},children:e.label})]},e.id)})}),(0,X.jsxs)(l.default,{testID:"desk-menu-foot",style:{minHeight:S.foot,flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderTopWidth:1,borderColor:P.colours.hairline},children:[(0,X.jsx)(f.Button,{kind:"secondary",small:!0,label:"Find a page "+(B?'\u2318K':'Ctrl+K'),onPress:p,testID:"desk-find"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Keys ?",accessibilityLabel:"Keyboard shortcuts",onPress:m,testID:"desk-keys"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Install",accessibilityLabel:"Install CoverCharge for desktop",onPress:x,testID:"desk-install"}),(0,X.jsx)(f.Button,{kind:"ghost",small:!0,label:"Sign out",accessibilityLabel:"Sign out of this computer",onPress:k,testID:"desk-signout"})]})]})]})}},1559,[17,266,347,219,385,278,85,409,19,780,812,779,777,1230,1395,1087,1482,1086,1084,1232,1245,891,876,1032,1490,880,899,804,1340,1560,1057,1420,1161,1484,1486,1475,1459,1488,1556,1558,1566,1567,1568,1571,1574,8]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.micAvailable=async function(){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}},_e.NoShows=$,_e.CarApp=function(){(0,M.useCarViewport)();const{width:e,height:o}=(0,d.default)(),n=Math.max(320,E(e)),{role:c,today:u,now:h}=(0,w.useCtx)(3e4),[f,p]=(0,t.useState)(o),x=n,[y,I]=(0,t.useState)(null),[D,R]=(0,t.useState)(!1),[H,$]=(0,t.useState)(!1),[_,V]=(0,t.useState)(!1);(0,t.useEffect)(()=>{(0,w.ensureAttendance)(u,h),(0,m.ensureChat)(h)},[u]),(0,t.useEffect)(()=>{if(v.PITCH)return;const e=setInterval(()=>{(0,k.carPairPoll)()},6e4);return()=>clearInterval(e)},[]),(0,t.useEffect)(()=>{'owner'!==c&&T.useOwner.getState().setPreviewRole('owner')},[c]);const A=(0,t.useCallback)(()=>I(null),[]);(0,j.useBackLayer)(!!y,A);const G=(0,t.useCallback)(()=>R(!1),[]);(0,j.useBackLayer)(D,G);const Y=e=>{R(!1),I({btn:e,page:e.pages[0].id})},F=(0,t.useCallback)((e,t)=>{const o=e=>B.CAR_BUTTONS.find(t=>t.pages.some(t=>t.id===e));if('home'===e)return I(null);if('bookings'===e)return I({btn:o('@bookings'),page:'@bookings'});if('chat'===e)return I({btn:o('@chat'),page:'@chat'});if('orders'===e||'forecast'===e)return I(t=>({btn:t?.btn??B.CAR_BUTTONS[3],page:'orders'===e?'@orders':'@forecast'}));if('more'===e&&t){const e=o(t);return I(o=>({btn:e??o?.btn??B.CAR_BUTTONS[0],page:t}))}I(null)},[]),X=x,q=y?y.btn.label:'';return(0,P.jsxs)(l.default,{testID:"car-app",onLayout:e=>{const t=Math.round(e.nativeEvent.layout.height);t>200&&Math.abs(t-f)>1&&p(t)},style:{flex:1,flexDirection:'row',backgroundColor:S.colours.bg,minHeight:0,width:n,maxWidth:'100%',overflow:'hidden'},children:[(0,P.jsxs)(l.default,{testID:"car-board",style:{width:x,minWidth:0,minHeight:0},children:[(0,P.jsx)(b.DisplayBoard,{embedded:!0,noVoice:!0,boardW:x,headerExtra:(0,P.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:10},children:[(0,P.jsx)(W.ParkedOnly,{small:n<1400}),(0,P.jsx)(z,{open:D,onPress:()=>R(!0)})]}),subHeader:(0,P.jsx)(L,{onRota:()=>Y(B.CAR_BUTTONS[0]),onAccount:()=>$(!0)})}),y?(0,P.jsxs)(l.default,{testID:"car-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:X,zIndex:40,backgroundColor:S.colours.bg},children:[(0,P.jsxs)(l.default,{testID:"car-panel-head",style:{flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-panel-close",accessibilityRole:"button",accessibilityLabel:`Close ${q}, back to the board`,onPress:()=>{(0,j.runBackLayer)()||A()},style:{minHeight:56,minWidth:96,paddingHorizontal:14,borderRadius:14,borderWidth:1,borderColor:S.colours.border,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",center:!0,children:"Close"})}),(0,P.jsx)(l.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,P.jsx)(C.T,{size:20,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,accessibilityRole:"header",children:y.btn.label})}),(0,P.jsx)(l.default,{style:{minWidth:96,alignItems:'flex-end'},children:(0,P.jsx)(z,{testID:"car-menu-button-page",open:D,onPress:()=>R(!0)})})]}),y.btn.pages.length>1?(0,P.jsx)(l.default,{testID:"car-panel-tabs",style:{flexDirection:'row',justifyContent:'center',flexWrap:'wrap',gap:8,paddingHorizontal:12,paddingVertical:8},children:y.btn.pages.map(e=>{const t=e.id===y.page;return(0,P.jsx)(s.default,{testID:`car-tab-${e.id.replace('@','')}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:e.label,onPress:()=>I({btn:y.btn,page:e.id}),style:{minHeight:48,paddingHorizontal:18,borderRadius:999,borderWidth:1,borderColor:t?S.colours.gold:S.colours.border,backgroundColor:t?O:'transparent',alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(C.T,{weight:"semibold",colour:t?S.colours.goldLight:S.colours.text,center:!0,children:e.label})},e.id)})}):null,(0,P.jsx)(a.default,{testID:"car-panel-scroll",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:32,gap:12,width:'100%',maxWidth:1200,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:(0,P.jsx)(U,{id:y.page,go:F},y.page)})]}):null]}),(0,P.jsx)(N,{visible:D,onClose:G,onPick:Y,current:y?.btn.id,W:n,H:f}),H?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>$(!1),title:"This car",maxWidth:560,testID:"car-account-sheet",children:[(0,P.jsx)(C.T,{center:!0,children:"This car is paired as an owner device for The Anchorage, with full owner access. Nobody is signed in. Changes are recorded as Car. Use it only when the car is in Park."}),(0,P.jsx)(C.Muted,{center:!0,children:"To unpair from your phone: Managers, More, Car screen. Only an owner can approve or revoke this pairing."}),(0,P.jsx)(C.Button,{testID:"car-sign-out",kind:"secondary",label:"Unpair this car",onPress:()=>{$(!1),V(!0)},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"ghost",label:"Close",onPress:()=>$(!1),style:{minHeight:56}})]}):null,_?(0,P.jsxs)(C.Sheet,{visible:!0,onClose:()=>V(!1),title:"Unpair this car?",maxWidth:520,testID:"car-sign-out-confirm",children:[(0,P.jsx)(C.T,{center:!0,children:"You\u2019ll need a new code, approved by an owner on their phone, to use it again."}),(0,P.jsx)(C.Button,{testID:"car-sign-out-yes",label:"Yes, unpair this car",onPress:()=>{V(!1),(0,k.carSignOut)()},style:{minHeight:56}}),(0,P.jsx)(C.Button,{kind:"secondary",label:"Cancel",onPress:()=>V(!1),style:{minHeight:56}})]}):null]})};var t=r(_d[0]),o=e(r(_d[1])),n=e(r(_d[2]));r(_d[3]);var s=e(r(_d[4])),a=e(r(_d[5])),l=e(r(_d[6])),d=e(r(_d[7])),c=r(_d[8]),u=e(c),h=r(_d[9]),b=r(_d[10]),f=r(_d[11]);r(_d[12]);var p=r(_d[13]),m=r(_d[14]),x=r(_d[15]),y=r(_d[16]),w=r(_d[17]),j=r(_d[18]),C=r(_d[19]),I=r(_d[20]),T=r(_d[21]),D=r(_d[22]),k=r(_d[23]),v=r(_d[24]),S=r(_d[25]),B=r(_d[26]),R=r(_d[27]),W=r(_d[28]),H=r(_d[29]),M=r(_d[30]),P=r(_d[31]);const O='rgba(201,162,74,0.14)';function L({onRota:e,onAccount:o}){const n=(0,T.useOwner)(e=>e.attendance),a=(0,T.useOwner)(e=>e.staff),[d,c]=(0,t.useState)(()=>Date.now());(0,t.useEffect)(()=>{const e=setInterval(()=>c(Date.now()),3e4);return()=>clearInterval(e)},[]);const u=n.filter(e=>e.in&&!e.out&&d-new Date(e.in).getTime()<72e6&&d>=new Date(e.in).getTime()).map(e=>(a.find(t=>t.id===e.staffId)?.name??'').replace(' (example)','')).filter(Boolean),h=[...new Set(u)],b=h.length?`On now: ${h.join(' \xb7 ')}`:'Nobody clocked in';return(0,P.jsxs)(l.default,{testID:"car-strip",style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',justifyContent:'center',gap:10,paddingHorizontal:12,paddingVertical:2,minHeight:44,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(s.default,{testID:"car-whos-on",accessibilityRole:"button",accessibilityLabel:`${b}. Opens the rota.`,onPress:e,style:{flexShrink:1,minHeight:44,justifyContent:'center',paddingHorizontal:8},children:(0,P.jsx)(C.T,{size:14,weight:"semibold",colour:S.colours.goldLight,numberOfLines:1,center:!0,children:b})}),(0,P.jsx)(s.default,{testID:"car-account",accessibilityRole:"button",accessibilityLabel:"This car is paired. Car pairing options.",onPress:o,style:{minHeight:44,justifyContent:'center',paddingHorizontal:12,borderRadius:22,borderWidth:1,borderColor:S.colours.gold,flexShrink:0},children:(0,P.jsx)(C.T,{size:13,weight:"semibold",colour:S.colours.gold,center:!0,numberOfLines:1,children:"Paired"})}),(0,P.jsx)(H.CarGameButton,{})]})}function $({go:e}){const{rid:t,now:o}=(0,w.useCtx)(3e4),n=(0,I.useBookings)(t),s=(0,D.ymd)(o),a=(0,D.ymd)(new Date(o.getTime()-24192e5)),d=n.filter(e=>'noshow'===e.status&&e.date>=a&&e.date<=s).sort((e,t)=>(t.date+t.time).localeCompare(e.date+e.time)),c=n.filter(e=>e.date===s&&'confirmed'===e.status&&!e.walkIn&&new Date(`${e.date}T${e.time}:00`).getTime()e+(t.partySize||0),0);return(0,P.jsxs)(l.default,{testID:"car-noshows",style:{gap:10},children:[(0,P.jsx)(C.T,{center:!0,size:18,weight:"semibold",colour:S.colours.goldLight,children:d.length?`${d.length} no-show${1===d.length?'':'s'} in the last 28 days \xb7 ${u} Covers`:'No no-shows in the last 28 days'}),c.length?(0,P.jsxs)(l.default,{testID:"car-late",style:{gap:6,borderWidth:1,borderColor:S.colours.amber,borderRadius:12,padding:12},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",colour:S.colours.amber,children:"Running more than 15 minutes late"}),c.map(e=>(0,P.jsx)(C.T,{center:!0,children:`${e.time} \xb7 ${e.name} \xb7 ${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}`},e.id)),(0,P.jsx)(C.Muted,{center:!0,children:"Call them first. If they don\u2019t come, mark No-show on their booking."})]}):null,d.map(e=>(0,P.jsxs)(l.default,{style:{borderWidth:1,borderColor:S.colours.border,borderRadius:12,padding:12,gap:2},children:[(0,P.jsx)(C.T,{center:!0,weight:"semibold",children:`${e.date===s?'Today':(0,D.niceDate)((0,D.parseYmd)(e.date))} \xb7 ${e.time} \xb7 ${e.name}`}),(0,P.jsx)(C.Muted,{center:!0,children:`${e.partySize} Covers${e.table?` \xb7 Table ${e.table}`:''}${e.phone?' \xb7 phone on the booking':''}`})]},e.id)),(0,P.jsx)(C.Button,{testID:"car-noshows-bookings",label:"Open Bookings to mark or undo a no-show",onPress:()=>e('bookings'),style:{minHeight:56}})]})}function z({onPress:e,open:t,testID:o="car-menu-button"}){return(0,P.jsx)(s.default,{testID:o,accessibilityRole:"button",accessibilityLabel:"Menu",accessibilityHint:"Opens the owner buttons: Rota, Bookings, Stock and more",accessibilityState:{expanded:t},onPress:e,style:({pressed:e})=>({width:B.MENU_BUTTON,height:B.MENU_BUTTON,borderRadius:B.MENU_BUTTON/2,borderWidth:1.5,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e||t?S.colours.goldTint:'rgba(207,164,95,0.10)',boxShadow:'0 4px 14px rgba(0,0,0,0.45)',cursor:'pointer'}),children:(0,P.jsx)(u.default,{width:24,height:24,viewBox:"0 0 24 24",pointerEvents:"none",children:[4,10.5,17].flatMap(e=>[4,10.5,17].map(t=>(0,P.jsx)(c.Rect,{x:t,y:e,width:3.6,height:3.6,rx:1.2,fill:S.colours.gold},`${t}-${e}`)))})})}function N({visible:e,onClose:a,onPick:d,current:c,W:u,H:b}){const[f,p]=(0,t.useState)(0),m=(0,B.menuSizes)(u,b),x=f?Math.floor((f-2*m.pad)/m.rows):m.per,y=Math.max(48,Math.min(76,x-m.lineH-18,m.colW-28)),w={...m,per:Math.min(x,y+m.lineH+60),circle:y},j=Math.round(.44*w.circle),I=(0,t.useRef)(new o.default.Value(0)).current,[T,D]=(0,t.useState)(e);if((0,t.useEffect)(()=>{e&&D(!0),o.default.timing(I,{toValue:e?1:0,duration:e?190:150,easing:n.default.out(n.default.cubic),useNativeDriver:!1}).start(({finished:t})=>{t&&!e&&D(!1)})},[e,I]),!T)return null;const k=I.interpolate({inputRange:[0,1],outputRange:[.35*w.panelW,0]});return(0,P.jsxs)(l.default,{testID:"car-menu",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:60},children:[(0,P.jsx)(o.default.View,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,opacity:I,backgroundColor:'rgba(0,0,0,0.55)'},children:(0,P.jsx)(s.default,{testID:"car-menu-backdrop",accessibilityRole:"button",accessibilityLabel:"Close menu",onPress:a,style:{flex:1}})}),(0,P.jsxs)(o.default.View,{testID:"car-menu-panel",accessibilityViewIsModal:!0,style:{position:'absolute',top:0,bottom:0,right:0,width:w.panelW,opacity:I,transform:[{translateX:k}],backgroundColor:'#0E0D0B',borderLeftWidth:1,borderColor:S.colours.accentBorder,borderTopLeftRadius:22,borderBottomLeftRadius:22,overflow:'hidden',boxShadow:'-24px 0 60px rgba(0,0,0,0.6)'},children:[(0,P.jsxs)(l.default,{style:{height:w.head,flexDirection:'row',alignItems:'center',paddingLeft:w.pad+4,paddingRight:14,borderBottomWidth:1,borderColor:S.colours.hairline},children:[(0,P.jsx)(l.default,{style:{flex:1,minWidth:0},children:(0,P.jsx)(C.T,{size:21,weight:"semibold",colour:S.colours.gold,accessibilityRole:"header",children:"Owner tools"})}),(0,P.jsx)(h.GoldClose,{testID:"car-menu-close",label:"Close menu",size:"lg",onPress:a})]}),(0,P.jsx)(l.default,{testID:"car-menu-grid",onLayout:e=>p(Math.round(e.nativeEvent.layout.height)),style:{flex:1,flexDirection:'row',flexWrap:'wrap',alignContent:'center',justifyContent:'center',padding:w.pad},children:B.CAR_BUTTONS.map(e=>{const t=c===e.id;return(0,P.jsxs)(s.default,{testID:`car-btn-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:t},accessibilityLabel:t?`${e.label}, open`:e.label,onPress:()=>d(e),style:({pressed:e})=>({width:w.colW,height:w.per,alignItems:'center',justifyContent:'center',gap:6,borderRadius:18,overflow:'hidden',backgroundColor:e?'rgba(207,164,95,0.08)':'transparent'}),children:[(0,P.jsx)(l.default,{style:{width:w.circle,height:w.circle,borderRadius:w.circle/2,borderWidth:1.5,borderColor:S.colours.gold,backgroundColor:t?S.colours.gold:O,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(R.CarGlyph,{name:e.icon,size:j,colour:t?'#0B0B0B':S.colours.goldLight})}),(0,P.jsx)(C.T,{size:w.label,weight:t?'semibold':'medium',colour:t?S.colours.goldLight:S.colours.text,center:!0,numberOfLines:1,style:{lineHeight:w.lineH,maxWidth:w.colW-8},children:w.colW<130?e.short:e.label})]},e.id)})})]})]})}function U({id:e,go:t}){if('@bookings'===e)return(0,P.jsx)(p.Bookings,{go:t});if('@chat'===e)return(0,P.jsx)(m.Chat,{go:t});if('@noshows'===e)return(0,P.jsx)($,{go:t});if('@orders'===e)return(0,P.jsx)(x.Orders,{});if('@forecast'===e)return(0,P.jsx)(y.Forecasts,{go:t});const o=(0,f.pageFor)(e);if(!o)return(0,P.jsx)(C.Muted,{center:!0,children:"This screen isn\u2019t in the car yet. Open it in Managers on your phone."});const n=o.C;return(0,P.jsx)(n,{go:t})}function E(e){if('undefined'==typeof document)return e;const t=document.documentElement?.clientWidth||e,o=window.visualViewport?.width||e;return Math.floor(Math.min(e,t,o))}},1560,[17,266,347,219,385,278,85,409,780,779,1340,1459,1488,1420,1161,1486,1484,1057,1026,777,858,876,863,899,880,804,1561,1562,1563,1564,1565,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1561,[]); +__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])},1562,[17,780,8]); +__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])},1563,[17,85,777,804,8]); +__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===c.VENUE_RID)?.settings?.games),[n,y]=(0,t.useState)(!1),[C]=(0,t.useState)(()=>new Date),_=(0,s.useGameClock)(null,n?new Date:C);return e?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"car-game-open",accessibilityRole:"button",accessibilityLabel:"Game: Lenny's Kitchen Chaos. Parked only.",onPress:()=>y(!0),style:{minHeight:44,justifyContent:'center',paddingHorizontal:14,borderRadius:22,borderWidth:1,borderColor:f.colours.gold,flexShrink:0},children:(0,h.jsx)(b.T,{size:13,weight:"semibold",colour:f.colours.gold,center:!0,numberOfLines:1,children:"Game"})}),n?(0,h.jsx)(s.BreakRoom,{car:!0,staffId:null,name:"Car",playable:(0,o.gamePlayable)(_),clock:_,onClose:()=>y(!1)}):null]}):null};var e,t=r(d[0]),n=r(d[1]),l=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]),b=r(d[6]),f=r(d[7]),h=r(d[8])},1564,[17,385,1163,1164,816,805,777,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useCarViewport=function(){(0,t.useEffect)(()=>{if(!o)return;const t=document.documentElement,n=document.body,s=[t.style.cssText,n.style.cssText];for(const o of[t.style,n.style])o.height='100%',o.margin='0',o.overflow='hidden',o.overscrollBehavior='none',o.touchAction='manipulation';return()=>{t.style.cssText=s[0],n.style.cssText=s[1]}},[])};var t=r(d[0]);r(d[1]);const o='undefined'!=typeof document},1565,[17,219]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_EXTRA",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DESK_BUTTONS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REQUIRED_DESK_BUTTONS",{enumerable:!0,get:function(){return l}}),e.tabsFor=c,e.buttonsFor=function(s){return o.filter(t=>c(t,s).length>0)},e.deskMenuSizes=function(s,t){const i=Math.ceil(o.length/4),n=Math.round(Math.max(320,Math.min(s-24,s>=1600?640:s>=1280?580:520))),l=Math.floor((n-36-2)/4),c=Math.floor(Math.max(88,(t-72-64-36)/i)),h=t>=1e3?15:13,b=Math.round(1.4*h),k=Math.max(48,Math.min(72,c-2*b-14,l-34));return{panelW:n,colW:l,per:c,circle:k,label:h,lineH:b,icon:Math.round(.44*k),cols:4,rows:i,head:72,foot:64,pad:18}},Object.defineProperty(e,"deskShortcut",{enumerable:!0,get:function(){return h}});var s=r(d[0]);const t={signoff:{last:[{id:'@desk-hours',label:'Hours table'}]},bookings:{first:[{id:'@desk-bookings',label:'Bookings table'}],last:[{id:'@bookings',label:'Day view'}]},takings:{first:[{id:'@desk-takings',label:'Takings charts',takings:!0}],last:[{id:'superpro-insights',label:'Insights',takings:!0}]}},i={rota:'Make and publish the rota',signoff:'Sign off clocked hours, timesheets and the hours table',menu:'Sold out, menu and allergens, table QR codes',bookings:'Every booking in a wide table, the day view and Look back',noshows:'No-shows in the last 28 days',chat:'Staff chat',stock:'Deliveries, GP, tracked stock, order lists and supplier links',loyalty:'The stamp card',takings:'Takings, cash ups, tips and spend per head',safety:'Food safety log and daily checks',reviews:'Read and answer reviews'},n=[{id:'history',label:'Historical data',short:'History',icon:'history',extra:!0,hint:'Look back by date, bookings and covers, takings, hours, fridge temperatures and the forecast',pages:[{id:'lookback',label:'Look back'},{id:'@desk-bookinghistory',label:'Bookings & covers'},{id:'@desk-takings',label:'Takings & tips',takings:!0},{id:'@desk-hours',label:'Hours'},{id:'@desk-temps',label:'Fridges & freezers'},{id:'@forecast',label:'Forecast'}]},{id:'leavers',label:'Staff leaving',short:'Leaving',icon:'leaver',extra:!0,hint:'Switch off a leaver\u2019s app, or switch it back on. Their hours, tips and rota are kept',pages:[{id:'@desk-leavers',label:'Staff leaving'}]},{id:'permissions',label:'Permissions',short:'Access',icon:'permissions',extra:!0,hint:'On and off switches for each level and each person',pages:[{id:'@desk-permissions',label:'Permissions'}]},{id:'settings',label:'Settings',short:'Settings',icon:'settings',extra:!0,hint:'Menu, opening hours, table plan, deposits, staff, wages, fridges, branding and more',pages:[{id:'@desk-settings',label:'All settings'}]}],o=[...s.CAR_BUTTONS.map(s=>{const n=t[s.id]??{},o=[...n.first??[],...s.pages.filter(s=>!(n.last??[]).some(t=>t.id===s.id)),...n.last??[]];return{id:s.id,label:s.label,short:s.short,icon:s.icon,hint:i[s.id]??s.label,pages:o}}),...n],l=['rota','signoff','menu','bookings','noshows','chat','stock','loyalty','takings','safety','reviews','history','leavers','permissions','settings'];function c(s,t){return s.pages.filter(s=>(!s.takings||t.takings)&&(s.id.startsWith('@')||t.pageOk(s.id)))}const h=(s,t)=>s>9?'':`${t?'\u2325':'Alt+'}${9===s?0:s+1}`},1566,[1561]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ddmmyyyy",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ukTime",{enumerable:!0,get:function(){return n}}),e.sortRows=function(t,n,a){if(!n)return t.slice();const l='asc'===a?1:-1;return t.map((t,a)=>({r:t,i:a,v:n.value(t)})).sort((t,n)=>{const a=t.v,i=n.v,r='number'==typeof a&&'number'==typeof i?a-i:String(a).localeCompare(String(i),'en-GB',{numeric:!0,sensitivity:'base'});return r?r*l:t.i-n.i}).map(t=>t.r)},e.filterRows=function(t,n,a){const l=a.toLowerCase().split(/\s+/).filter(Boolean);return l.length?t.filter(t=>{const a=n.map(n=>n.text?n.text(t):String(n.value(t))).join(' ').toLowerCase();return l.every(t=>a.includes(t))}):t.slice()},e.csvCell=a,e.toCsv=function(t,n){return[n.map(t=>a(t.label)).join(','),...t.map(t=>n.map(n=>a(n.text?n.text(t):n.value(t))).join(','))].join('\r\n')},Object.defineProperty(e,"csvName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"STATUS_WORD",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"sourceWord",{enumerable:!0,get:function(){return o}}),e.bookingColumns=function(n){const a=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.time}`,text:n=>t(n.date)},{key:'time',label:'Time',width:70,value:t=>t.time},{key:'name',label:'Name',width:190,value:t=>t.walkIn?'Walk-in':t.name},{key:'party',label:'Covers',width:76,value:t=>t.partySize,numeric:!0},{key:'table',label:'Table',width:84,value:t=>t.table??'',text:t=>t.table||'No table'},{key:'status',label:'Status',width:140,value:t=>r[t.status]??t.status},{key:'source',label:'From',width:96,value:t=>o(t)},{key:'allergies',label:'Allergies',width:150,value:t=>t.allergies?.length?t.allergies.map(t=>i[t.allergen]??t.allergen).join(', '):t.allergyNone?'None':''},{key:'deposit',label:'Deposit',width:88,value:t=>t.depositPaid??0,text:t=>s(t.depositPaid)||(t.depositDue?`Due ${s(t.depositDue)}`:''),numeric:!0},{key:'notes',label:'Notes',width:240,value:t=>[t.occasion??'',...t.tags??[],t.notes??''].filter(Boolean).join(' \xb7 ')}];n&&a.splice(4,0,{key:'phone',label:'Phone',width:132,value:t=>t.phone??''});return a},e.bookingsBetween=function(t,n,a,l){return t.filter(t=>t.date>=n&&t.date<=a&&('all'===l||('active'===l?'cancelled'!==t.status&&'noshow'!==t.status:t.status===l))).sort((t,n)=>(t.date+t.time).localeCompare(n.date+n.time))},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"HOURS_COLUMNS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"totalPaid",{enumerable:!0,get:function(){return c}}),e.perDay=function(t,n){return t.map(t=>({date:t,value:n(t)}))},e.lastDays=function(t,n){const a=[],l=new Date(`${t}T12:00:00Z`);for(let t=n-1;t>=0;t--){const n=new Date(l);n.setUTCDate(l.getUTCDate()-t),a.push(n.toISOString().slice(0,10))}return a};const t=t=>/^\d{4}-\d{2}-\d{2}/.test(t)?`${t.slice(8,10)}/${t.slice(5,7)}/${t.slice(0,4)}`:t,n=t=>t?new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,timeZone:'Europe/London'}):'';function a(t){let n=String(t??'');return/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}const l=(n,a,l)=>`anchorage-${n}-${t(a).replace(/\//g,'-')}${l&&l!==a?`-to-${t(l).replace(/\//g,'-')}`:''}.csv`,i={gluten:'Gluten',crustaceans:'Crustaceans',molluscs:'Molluscs',eggs:'Eggs',fish:'Fish',peanuts:'Peanuts',treenuts:'Tree nuts',soya:'Soya',milk:'Milk',celery:'Celery',mustard:'Mustard',sesame:'Sesame',sulphites:'Sulphites',lupin:'Lupin'},r={pending:'Needs confirming',confirmed:'Booked',seated:'Seated',finished:'Done',noshow:'No-show',cancelled:'Cancelled'},o=t=>t.walkIn||'walk-in'===t.source?'Walk-in':'phone'===t.source?'Phone':'in-person'===t.source?'In person':'online'===t.source?'Website':'Phone',s=t=>t?`\xa3${(t/100).toFixed(2)}`:'';const u=t=>`${Math.floor(Math.max(0,t)/60)}h ${String(Math.round(Math.max(0,t)%60)).padStart(2,'0')}m`,d=[{key:'date',label:'Date',width:108,value:t=>`${t.date} ${t.inT}`,text:n=>t(n.date)},{key:'name',label:'Name',width:180,value:t=>t.name},{key:'job',label:'Job',width:150,value:t=>t.job},{key:'in',label:'In',width:70,value:t=>t.inT},{key:'out',label:'Out',width:70,value:t=>t.outT,text:t=>t.outT||'On now'},{key:'break',label:'Break',width:80,value:t=>t.breakMins,text:t=>t.breakMins?`${t.breakMins} min`:'None',numeric:!0},{key:'paid',label:'Paid hours',width:100,value:t=>t.paidMins,text:t=>u(t.paidMins),numeric:!0},{key:'status',label:'Status',width:170,value:t=>t.status},{key:'signed',label:'Signed off by',width:140,value:t=>t.signedBy},{key:'note',label:'Note',width:200,value:t=>t.note}],c=t=>t.reduce((t,n)=>t+n.paidMins,0)},1567,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTakingsAllowed=N,_e.Grid=W,_e.Panel=L,_e.DesktopHome=function({go:e}){const{rid:s,role:a,today:i,now:l}=(0,w.useCtx)(3e4),u=(0,g.useBookings)(s),h=(0,y.useCashUp)(e=>e.cashUps),b=(0,f.useOwner)(e=>e.staff),x=(0,f.useOwner)(e=>e.attendance),j=N(a),C=P('kitchencosts',a),S=u.filter(e=>'pending'===e.status&&e.date>=i).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time)),T=u.filter(e=>e.date===i&&'cancelled'!==e.status&&'noshow'!==e.status).sort((e,t)=>e.time.localeCompare(t.time)),R=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,O=T.filter(e=>'confirmed'===e.status&&e.time>=R).slice(0,6),B=(0,f.liveAttendance)(x).filter(e=>e.date===i&&e.in&&!e.out).map(e=>b.find(t=>t.id===e.staffId)?.name.replace(' (example)','')).filter(Boolean),U=(0,t.useMemo)(()=>[...(0,D.lastDays)(i,21),...[1,2,3,4,5,6,7].map(e=>M(i,e))].map(e=>({date:e,value:(0,m.coversFour)(u,e).total||0,future:e>i})),[u,i]),A=h.filter(e=>e.rid===s&&e.confirmedAt),_=(0,t.useMemo)(()=>(0,D.lastDays)(i,28).map(e=>{const t=A.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),[A,i]);return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-home",children:[(0,I.jsxs)(W,{min:330,children:[(0,I.jsx)(L,{title:"Covers today",testID:"desk-home-covers",children:(0,I.jsx)(r.CoversToday,{rid:s,big:!0,onPress:()=>e('bookings'),testID:"desk-covers-today"})}),(0,I.jsx)(L,{title:`Needs confirming (${S.length})`,testID:"desk-home-pending",action:(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Open Bookings",onPress:()=>e('bookings')}),children:S.length?S.slice(0,5).map(e=>(0,I.jsxs)(n.default,{accessible:!0,accessibilityLabel:`${e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}. Needs confirming.`,style:{alignItems:'center',paddingVertical:4,borderTopWidth:1,borderColor:k.colours.hairline},children:[(0,I.jsxs)(o.T,{weight:"semibold",center:!0,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsxs)(o.Muted,{center:!0,children:[(0,D.ddmmyyyy)(e.date)," at ",e.time]})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"Nothing waiting. Every booking is confirmed."})}),(0,I.jsxs)(L,{title:"Next to arrive",testID:"desk-home-next",children:[O.length?O.map(e=>(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(o.T,{size:15,weight:"semibold",colour:k.colours.gold,children:e.time}),(0,I.jsxs)(o.T,{size:15,children:[e.name," \xb7 ",e.partySize]}),(0,I.jsx)(o.Muted,{children:e.table?`Table ${e.table}`:'No table'})]},e.id)):(0,I.jsx)(o.Muted,{center:!0,children:"No more bookings to arrive today."}),(0,I.jsx)(o.Muted,{center:!0,children:B.length?`On now: ${B.join(', ')}`:'Nobody is clocked in right now.'})]})]}),(0,I.jsxs)(W,{min:480,children:[(0,I.jsx)(L,{testID:"desk-home-covers-chart",children:(0,I.jsx)(v.WideChart,{title:"Covers by day",sub:"Last 3 weeks, then the next 7 days booked so far (lighter)",points:U,fmt:e=>String(Math.round(e)),today:i,testID:"chart-covers",valueLabel:"Covers"})}),j?(0,I.jsx)(L,{testID:"desk-home-takings",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 28 days",sub:"Card + cash from signed-off cash ups. A grey stub means no cash up that day.",points:_,fmt:$,today:i,testID:"chart-takings",valueLabel:"Takings"})}):null]}),(0,I.jsxs)(W,{min:480,children:[C?(0,I.jsx)(L,{testID:"desk-home-gp",children:(0,I.jsx)(c.GpOverTime,{rid:s})}):null,j?(0,I.jsxs)(L,{title:"Tips",testID:"desk-home-tips",children:[(0,I.jsx)(d.TodaysTipsCard,{rid:s,today:i}),(0,I.jsx)(d.TipsPotCard,{rid:s,today:i})]}):null]})]})},_e.rangeDates=U,_e.FilterBox=_,_e.DesktopBookings=function({filterRef:e}){const{rid:s,today:a,me:i,role:l}=(0,w.useCtx)(15e3),r=(0,g.useBookings)(s),[d,c]=(0,t.useState)('table'),[y,f]=(0,t.useState)('next7'),[m,p]=(0,t.useState)('active'),[x,C]=(0,t.useState)(''),[T,v]=(0,t.useState)(!1),[$,R]=(0,t.useState)('date'),[M,O]=(0,t.useState)('asc'),[N,P]=(0,t.useState)(null),[W,L]=U(y,a),z=(0,t.useMemo)(()=>(0,D.bookingColumns)(T),[T]),E=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)((0,D.bookingsBetween)(r,W,L,m),z,x),z.find(e=>e.key===$),M),[r,W,L,m,z,x,$,M]),F=E.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status).reduce((e,t)=>e+t.partySize,0),G=N?r.find(e=>e.id===N.id)??N:null;return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-bookings",children:[(0,I.jsxs)(o.Row,{style:{justifyContent:'center'},gap:8,children:[(0,I.jsx)(o.Chip,{label:"Table",selected:'table'===d,onPress:()=>c('table'),testID:"desk-bk-view-table",accessibilityLabel:"Show bookings as a table"}),(0,I.jsx)(o.Chip,{label:"Day view",selected:'day'===d,onPress:()=>c('day'),testID:"desk-bk-view-day",accessibilityLabel:"Show one day, with confirm, seat and edit"})]}),'day'===d?(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:980,alignSelf:'center'},children:(0,I.jsx)(j.Bookings,{})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.default,{role:"group",'aria-label':'Which dates',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:B.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:y===e,onPress:()=>f(e),testID:`desk-bk-range-${e}`},e))})}),(0,I.jsx)(n.default,{role:"group",'aria-label':'Which bookings',children:(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:A.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:m===e,onPress:()=>p(e),testID:`desk-bk-status-${e}`},e))})}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:x,onChange:C,label:"Filter by name, table, allergy or note",inputRef:e,testID:"desk-bk-filter"}),(0,I.jsx)(o.Chip,{label:T?'Hide phone numbers':'Show phone numbers',selected:T,onPress:()=>v(e=>!e),testID:"desk-bk-phones"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-bk-csv",accessibilityLabel:`Export these ${E.length} bookings as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('bookings',W,L),(0,D.toCsv)(E,z))})]}),(0,I.jsx)(n.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-bk-count",children:`${E.length} ${1===E.length?'booking':'bookings'} \xb7 ${F} covers \xb7 ${(0,D.ddmmyyyy)(W)}${L!==W?` to ${(0,D.ddmmyyyy)(L)}`:''}`})}),(0,I.jsx)(S.DataTable,{caption:`Bookings ${(0,D.ddmmyyyy)(W)} to ${(0,D.ddmmyyyy)(L)}`,cols:z,rows:E,rowKey:e=>e.id,sortKey:$,dir:M,onSort:e=>{e===$?O(e=>'asc'===e?'desc':'asc'):(R(e),O('asc'))},testID:"desk-bk-table",onRowPress:e=>P(e),rowLabel:e=>`${e.walkIn?'Walk-in':e.name}, ${e.partySize} people, ${(0,D.ddmmyyyy)(e.date)} at ${e.time}, ${e.table?`table ${e.table}`:'no table'}, ${D.STATUS_WORD[e.status]??e.status}`,empty:"No bookings match. Try another date range or clear the filter."})]}),G?(0,I.jsxs)(o.Sheet,{visible:!0,onClose:()=>P(null),title:`${G.walkIn?'Walk-in':G.name} \xb7 ${G.partySize}`,maxWidth:560,testID:"desk-bk-sheet",children:[(0,I.jsxs)(o.T,{center:!0,children:[(0,D.ddmmyyyy)(G.date)," at ",G.time," \xb7 ",G.table?`Table ${G.table}`:'No table'," \xb7 ",D.STATUS_WORD[G.status]??G.status]}),G.phone&&T?(0,I.jsx)(o.T,{center:!0,children:G.phone}):null,G.allergies?.length?(0,I.jsxs)(o.T,{center:!0,colour:k.colours.amber,children:["Allergies: ",G.allergies.map(e=>e.allergen).join(', ')]}):null,G.notes?(0,I.jsx)(o.Muted,{center:!0,children:G.notes}):null,(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:10,children:[(0,I.jsx)(h.BookingTableButton,{rid:s,booking:G,readOnly:G.datee.staff),d=(0,f.useOwner)(e=>e.attendance),[c,u]=(0,t.useState)('table'),[h,g]=(0,t.useState)('thisweek'),[y,m]=(0,t.useState)(''),[p,x]=(0,t.useState)('all'),[j,T]=(0,t.useState)('date'),[v,$]=(0,t.useState)('desc'),[R,M]=E(h,i),O=(0,t.useMemo)(()=>(0,f.liveAttendance)(d).filter(e=>e.in&&e.date>=R&&e.date<=M).map(e=>{const t=r.find(t=>t.id===e.staffId),s=(0,w.paidMins)(e,l);return{id:e.id,date:e.date,name:(t?.name??'Former team member').replace(' (example)',''),job:t?.job??'',inT:(0,D.ukTime)(e.in),outT:(0,D.ukTime)(e.out),breakMins:s.brk,paidMins:s.paid,status:e.out?e.signOff?'Signed off':'Waiting for sign-off':'On now',signedBy:e.signOff?.by?.replace(' (example)','')??'',note:e.adjusted?`Changed: ${e.adjusted.reason}`:e.added?'Added by a manager':e.auto?'From the rota':'display'===e.via?'Clocked on the Display':''}}),[d,r,R,M,l]),N=(0,t.useMemo)(()=>(0,D.sortRows)((0,D.filterRows)(O.filter(e=>'all'===p||e.status===p),D.HOURS_COLUMNS,y),D.HOURS_COLUMNS.find(e=>e.key===j),v),[O,p,y,j,v]),P=t=>{const s=(0,C.pageFor)(t);return!s||s.can&&!s.can(a)?(0,I.jsx)(o.Muted,{center:!0,children:"That page isn\u2019t available for your role."}):(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:(0,I.jsx)(s.C,{go:e})})};return(0,I.jsxs)(n.default,{style:{gap:14},testID:"desk-hours",children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:8,children:[['table','Hours table'],['signoff','Sign off hours'],['rota','Rota'],['payroll','Payroll hours']].map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:c===e,onPress:()=>u(e),testID:`desk-hr-tab-${e}`},e))}),'signoff'===c?P('signoff'):'rota'===c?P('rota'):'payroll'===c?P('hours'):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:z.map(([e,t])=>(0,I.jsx)(o.Chip,{label:t,selected:h===e,onPress:()=>g(e),testID:`desk-hr-range-${e}`},e))}),(0,I.jsx)(o.Row,{wrap:!0,style:{justifyContent:'center'},gap:6,children:['all','Waiting for sign-off','Signed off','On now'].map(e=>(0,I.jsx)(o.Chip,{label:'all'===e?'All shifts':e,selected:p===e,onPress:()=>x(e),testID:`desk-hr-status-${e.split(' ')[0].toLowerCase()}`},e))}),(0,I.jsxs)(o.Row,{wrap:!0,style:{justifyContent:'center',alignItems:'center'},gap:10,children:[(0,I.jsx)(_,{value:y,onChange:m,label:"Filter by name, job or note",inputRef:s,testID:"desk-hr-filter"}),(0,I.jsx)(o.Button,{kind:"secondary",small:!0,label:"Export CSV",testID:"desk-hr-csv",accessibilityLabel:`Export these ${N.length} shifts as a CSV file`,onPress:()=>(0,b.downloadText)((0,D.csvName)('hours',R,M),(0,D.toCsv)(N,D.HOURS_COLUMNS))})]}),(0,I.jsx)(n.default,{'aria-live':'polite',children:(0,I.jsx)(o.T,{size:14,colour:k.colours.muted,center:!0,testID:"desk-hr-count",children:`${N.length} ${1===N.length?'shift':'shifts'} \xb7 ${(0,D.hm)((0,D.totalPaid)(N))} paid \xb7 ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`})}),(0,I.jsx)(S.DataTable,{caption:`Hours ${(0,D.ddmmyyyy)(R)} to ${(0,D.ddmmyyyy)(M)}`,cols:D.HOURS_COLUMNS,rows:N,rowKey:e=>e.id,sortKey:j,dir:v,onSort:e=>{e===j?$(e=>'asc'===e?'desc':'asc'):(T(e),$('asc'))},testID:"desk-hr-table",empty:"No shifts in these dates."}),(0,I.jsx)(o.Muted,{center:!0,children:"To change or sign off a shift, open Sign off hours. Pay rates stay in Payroll, for people with pay and wages access."})]})]})},_e.DesktopTakings=function({go:e}){const{rid:t,role:s,today:a}=(0,w.useCtx)(6e4),i=(0,y.useCashUp)(e=>e.cashUps),l=N(s),r=(0,C.pageFor)('cashup'),d=i.filter(e=>e.rid===t&&e.confirmedAt),c=(0,D.lastDays)(a,42),u=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.tillTakingsOf)(t.vals):null}}),h=c.map(e=>{const t=d.find(t=>t.date===e);return{date:e,value:t?(0,p.combinedTips)(t.vals):null}});return(0,I.jsxs)(n.default,{style:{gap:16},testID:"desk-takings",children:[l?(0,I.jsxs)(W,{min:520,children:[(0,I.jsx)(L,{testID:"desk-tk-chart",children:(0,I.jsx)(v.WideChart,{title:"Takings, last 6 weeks",sub:"Card + cash from signed-off cash ups",points:u,fmt:$,today:a,testID:"chart-takings-6w",valueLabel:"Takings"})}),(0,I.jsx)(L,{testID:"desk-tips-chart",children:(0,I.jsx)(v.WideChart,{title:"Tips, last 6 weeks",sub:"Card + cash tips, team total",points:h,fmt:R,today:a,testID:"chart-tips-6w",valueLabel:"Tips"})})]}):null,(0,I.jsx)(n.default,{style:{width:'100%',maxWidth:1040,alignSelf:'center'},children:!r||r.can&&!r.can(s)?(0,I.jsx)(o.Muted,{center:!0,children:"Cash up isn\u2019t available for your role."}):(0,I.jsx)(r.C,{go:e})})]})},_e.DesktopSettings=function({open:e}){const{role:t}=(0,w.useCtx)(6e4),{width:s}=(0,i.default)(),l=e=>!e.can||e.can(t),r=[{g:'Owners use most',items:T.OWNER_SETTINGS.map(e=>C.PAGES.find(t=>t.id===e)).filter(e=>!!e&&l(e))},...T.SETTINGS_GROUPS.map(e=>({g:e,items:C.PAGES.filter(t=>t.group===e&&l(t)&&!T.OWNER_SETTINGS.includes(t.id))}))].filter(e=>e.items.length);return(0,I.jsx)(n.default,{style:{gap:20},testID:"desk-settings",children:r.map(({g:t,items:i})=>(0,I.jsxs)(n.default,{style:{gap:10},children:[(0,I.jsx)(n.default,{role:"heading",'aria-level':2,children:(0,I.jsx)(o.T,{size:13,weight:"semibold",colour:k.colours.goldMuted,center:!0,style:{letterSpacing:1},children:t.toUpperCase()})}),(0,I.jsx)(W,{min:s>=1400?300:260,gap:12,children:i.map(t=>(0,I.jsxs)(a.default,{accessibilityRole:"button",accessibilityLabel:(0,T.deskCopy)(`${t.title}. ${t.sub}`),testID:`desk-set-${t.id}`,onPress:()=>e(t.id),style:({hovered:e,focused:t})=>({height:'100%',minHeight:92,padding:14,borderRadius:14,borderWidth:1,borderColor:t?k.colours.gold:k.colours.border,backgroundColor:e?k.colours.tilePressed:k.colours.surface,alignItems:'center',justifyContent:'center',gap:4}),children:[(0,I.jsxs)(o.Row,{gap:6,style:{justifyContent:'center'},children:[(0,I.jsx)(o.T,{weight:"semibold",center:!0,children:(0,T.deskCopy)(t.title)}),t.badge?(0,I.jsx)(o.Badge,{kind:"gold",label:t.badge}):null]}),(0,I.jsx)(o.Muted,{center:!0,children:(0,T.deskCopy)(t.sub??'')})]},t.id))})]},t))})};var t=_r(_d[0]),s=e(t),a=e(_r(_d[1])),n=e(_r(_d[2])),i=e(_r(_d[3])),l=_r(_d[4]),o=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),y=_r(_d[12]),f=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),b=_r(_d[16]),x=_r(_d[17]),k=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),D=_r(_d[24]),v=_r(_d[25]),I=_r(_d[26]);const $=e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,R=e=>`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,M=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)},O=e=>{const t=new Date(`${e}T12:00:00Z`);return M(e,-(t.getUTCDay()+6)%7)};function N(e){const t=(0,x.useSync)(e=>'staff'===e.kind&&!!e.venueId&&'off'!==e.mode&&'local'!==e.mode),s=(0,x.useSync)(e=>e.perms);return f.CAN.takings(e)&&(!t||s.includes('*')||s.includes('takings.view'))}const P=(e,t)=>{const s=(0,C.pageFor)(e);return!!s&&(!s.can||s.can(t))};function W({children:e,min:t=320,gap:a=16}){const i=s.default.Children.toArray(e).filter(Boolean);return(0,I.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:a},children:i.map((e,s)=>(0,I.jsx)(n.default,{style:{flexGrow:1,flexShrink:1,flexBasis:t,minWidth:Math.min(t,280)},children:e},s))})}function L({title:e,children:t,testID:s,action:a}){return(0,I.jsxs)(n.default,{testID:s,style:{backgroundColor:k.colours.surface,borderWidth:1,borderColor:k.colours.border,borderRadius:16,padding:18,gap:12,height:'100%'},children:[e?(0,I.jsx)(n.default,{role:"heading",'aria-level':2,style:{alignItems:'center'},children:(0,I.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}):null,t,a?(0,I.jsx)(n.default,{style:{alignItems:'center',marginTop:'auto'},children:a}):null]})}const B=[['today','Today'],['tomorrow','Tomorrow'],['next7','Next 7 days'],['thisweek','This week'],['next30','Next 30 days'],['last30','Last 30 days']];function U(e,t){if('today'===e)return[t,t];if('tomorrow'===e){const e=M(t,1);return[e,e]}if('next7'===e)return[t,M(t,6)];if('thisweek'===e){const e=O(t);return[e,M(e,6)]}return'next30'===e?[t,M(t,29)]:[M(t,-29),t]}const A=[['active','Not cancelled'],['all','All'],['pending','Needs confirming'],['confirmed','Booked'],['seated','Seated'],['finished','Done'],['cancelled','Cancelled'],['noshow','No-show']];function _({value:e,onChange:t,label:s,inputRef:a,testID:n}){return(0,I.jsx)(l.TextInput,{ref:a,testID:n,value:e,onChangeText:t,placeholder:`${s} (press /)`,placeholderTextColor:k.colours.muted,accessibilityLabel:s,style:[o.styles.input,{minWidth:260,flexGrow:1,maxWidth:420,fontSize:14}]})}const z=[['thisweek','This week'],['lastweek','Last week'],['last14','Last 14 days'],['thismonth','This month']];function E(e,t){const s=O(t);return'thisweek'===e?[s,M(s,6)]:'lastweek'===e?[M(s,-7),M(s,-1)]:'last14'===e?[M(t,-13),t]:[`${t.slice(0,8)}01`,t]}},1568,[17,385,85,409,812,777,1072,1032,1180,1122,1091,858,1008,876,1055,839,889,899,804,1420,1057,1459,1569,1558,1567,1570,8]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX_ROWS",{enumerable:!0,get:function(){return c}}),_e.DataTable=function({caption:e,cols:a,rows:u,rowKey:h,sortKey:f,dir:b,onSort:x,onRowPress:y,rowLabel:w,testID:j,empty:p="Nothing to show."}){const C=Math.round(.8*a.reduce((e,r)=>e+r.width,0)),T=u.slice(0,c),$=(e,r,o,l)=>(0,i.jsx)(t.default,{role:o?'columnheader':'cell',...l??{},style:{flexGrow:e.width,flexShrink:1,flexBasis:0,minWidth:Math.round(.8*e.width),paddingHorizontal:10,paddingVertical:o?0:9,justifyContent:'center',alignItems:e.numeric?'flex-end':'flex-start'},children:r},e.key);return(0,i.jsx)(o.default,{horizontal:!0,contentContainerStyle:{minWidth:'100%'},style:{borderWidth:1,borderColor:s.colours.border,borderRadius:12},testID:j,children:(0,i.jsxs)(t.default,{role:"table",...n({'aria-label':e,'aria-rowcount':T.length+1}),style:{flexGrow:1,minWidth:C},children:[(0,i.jsx)(t.default,{role:"row",style:{flexDirection:'row',backgroundColor:s.colours.surface2,borderBottomWidth:1,borderColor:s.colours.border,borderTopLeftRadius:12,borderTopRightRadius:12},children:a.map(e=>{const o=f===e.key,c=o?'asc'===b?'ascending':'descending':'none';return $(e,x?(0,i.jsxs)(r.default,{accessibilityRole:"button",testID:`${j??'table'}-sort-${e.key}`,accessibilityLabel:`${e.label}. ${o?`Sorted ${c}. Press to sort ${'asc'===b?'descending':'ascending'}`:'Press to sort'}`,onPress:()=>x(e.key),style:({hovered:r,focused:o})=>({minHeight:44,flexDirection:'row',alignItems:'center',gap:4,paddingHorizontal:4,borderRadius:6,backgroundColor:r||o?s.colours.tilePressed:'transparent',alignSelf:e.numeric?'flex-end':'flex-start'}),children:[(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:o?s.colours.gold:s.colours.goldMuted,children:e.label}),(0,i.jsx)(l.T,{size:12,colour:o?s.colours.gold:s.colours.muted,accessibilityLabel:"",children:o?'asc'===b?'\u25b2':'\u25bc':'\u2195'})]}):(0,i.jsx)(t.default,{style:{minHeight:44,justifyContent:'center'},children:(0,i.jsx)(l.T,{size:13,weight:"semibold",colour:s.colours.goldMuted,children:e.label})}),!0,n({'aria-sort':c}))})}),T.length?T.map((e,o)=>{const n=a.map(r=>$(r,(0,i.jsx)(l.T,{size:14,colour:s.colours.text,style:{textAlign:r.numeric?'right':'left'},children:r.text?r.text(e):String(r.value(e))}))),c=({hovered:e,focused:r})=>({flexDirection:'row',borderTopWidth:o?1:0,borderColor:s.colours.hairline,backgroundColor:e||r?s.colours.tilePressed:o%2?'rgba(255,255,255,0.02)':'transparent'});return y?(0,i.jsx)(r.default,{role:"row",testID:`${j??'table'}-row-${o}`,accessibilityLabel:w?.(e),accessibilityHint:"Opens the details",onPress:()=>y(e),style:c,children:n},h(e)):(0,i.jsx)(t.default,{role:"row",style:c({}),children:n},h(e))}):(0,i.jsx)(t.default,{role:"row",style:{padding:18},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{colour:s.colours.muted,center:!0,children:p})})}),u.length>c?(0,i.jsx)(t.default,{role:"row",style:{padding:12},children:(0,i.jsx)(t.default,{role:"cell",style:{flex:1},children:(0,i.jsx)(l.T,{size:13,colour:s.colours.muted,center:!0,children:`Showing the first ${c} of ${u.length}. Export CSV for all of them.`})})}):null]})})},_r(d[0]);var r=e(_r(d[1])),o=e(_r(d[2])),t=e(_r(d[3])),l=_r(d[4]),s=_r(d[5]),i=_r(d[6]);const n=e=>e,c=500},1569,[17,385,278,85,777,804,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.axisTop=x,_e.chartSummary=v,_e.WideChart=function({title:e,sub:$,points:b,fmt:M,today:j,height:p=260,testID:w,valueLabel:_="Amount"}){const[S,k]=(0,t.useState)(0),[D,I]=(0,t.useState)(!1),L=x(Math.max(0,...b.map(e=>e.value??0))),T=Math.max(0,S-64-12),z=p-18-34,A=b.length?T/b.length:0,F=Math.max(2,Math.min(34,.68*A)),P=Math.max(1,Math.ceil(b.length/Math.max(1,Math.floor(T/54)))),R=[{key:'date',label:'Date',width:140,value:e=>e.date,text:e=>(0,c.ddmmyyyy)(e.date)},{key:'v',label:_,width:140,value:e=>e.value??-1,text:e=>null==e.value?'No figure':`${M(e.value)}${e.future?' (booked so far)':''}`,numeric:!0}];return(0,f.jsxs)(i.default,{testID:w,style:{gap:8},children:[(0,f.jsxs)(i.default,{style:{alignItems:'center',gap:2},children:[(0,f.jsx)(i.default,{role:"heading",'aria-level':2,children:(0,f.jsx)(o.T,{size:17,weight:"semibold",center:!0,children:e})}),$?(0,f.jsx)(o.T,{size:13,colour:s.colours.muted,center:!0,children:$}):null]}),(0,f.jsx)(i.default,{onLayout:e=>k(Math.floor(e.nativeEvent.layout.width)),role:"img",'aria-label':v(e,b,M),style:{width:'100%',height:p},children:S>0?(0,f.jsxs)(u.default,{width:S,height:p,'aria-hidden':!0,children:[[0,1,2,3,4].map(e=>{const t=18+z-z*e/4;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Line,{x1:64,x2:S-12,y1:t,y2:t,stroke:e?'rgba(255,255,255,0.08)':s.colours.border,strokeWidth:1}),(0,f.jsx)(n.Text,{x:56,y:t+4,fill:s.colours.muted,fontSize:11,textAnchor:"end",fontFamily:"Poppins_400Regular",children:M(L*e/4).replace(/\.00$/,'')})]},e)}),b.map((e,t)=>{const i=64+A*t+(A-F)/2,u=null==e.value?2:Math.max(2,e.value/L*z),o=null==e.value?'#3A3732':e.future?'rgba(207,164,95,0.45)':e.date===j?s.colours.goldLight:s.colours.gold;return(0,f.jsxs)(l.default.Fragment,{children:[(0,f.jsx)(n.Rect,{x:i,y:18+z-u,width:F,height:u,rx:Math.min(4,F/3),fill:o}),t%P===0||e.date===j?(0,f.jsx)(n.Text,{x:i+F/2,y:p-12,fill:e.date===j?s.colours.goldLight:s.colours.muted,fontSize:11,textAnchor:"middle",fontFamily:"Poppins_400Regular",children:y(e.date)}):null]},e.date)})]}):null}),(0,f.jsx)(i.default,{style:{alignItems:'center'},children:(0,f.jsx)(o.Button,{kind:"ghost",small:!0,label:D?'Hide the figures':'Show the figures',accessibilityLabel:`${D?'Hide':'Show'} the figures for ${e} as a table`,onPress:()=>I(e=>!e),testID:w?`${w}-figures`:void 0})}),D?(0,f.jsx)(h.DataTable,{caption:`${e}, figures`,cols:R,rows:b,rowKey:e=>e.date,testID:w?`${w}-table`:void 0}):null]})};var t=r(d[0]),l=e(t),i=e(r(d[1])),n=r(d[2]),u=e(n),o=r(d[3]),s=r(d[4]),h=r(d[5]),c=r(d[6]),f=r(d[7]);const y=e=>`${e.slice(8,10)}/${e.slice(5,7)}`;function x(e){if(e<=0)return 4;const t=e/4,l=Math.pow(10,Math.floor(Math.log10(t))),i=t/l,n=((l>=10?[1,1.5,2,2.5,3,4,5,6,7.5,8,10]:[1,2,3,4,5,6,8,10]).find(e=>e>=i-1e-9)??10)*l;return Math.max(4,4*Math.ceil(n))}function v(e,t,l){const i=t.filter(e=>null!=e.value&&!e.future);if(!i.length)return`${e}: no figures yet.`;const n=i.reduce((e,t)=>e+t.value,0),u=i.reduce((e,t)=>t.value>e.value?t:e,i[0]);return`${e}, ${(0,c.ddmmyyyy)(t[0].date)} to ${(0,c.ddmmyyyy)(t[t.length-1].date)}: total ${l(n)}, average ${l(n/i.length)} on ${i.length} days with figures, best ${l(u.value)} on ${(0,c.ddmmyyyy)(u.date)}.`}},1570,[17,85,780,777,804,1569,1567,8]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DeskGlyph=function({name:e,size:t,colour:s}){const l={stroke:s,strokeWidth:1.8,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return'history'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Path,{d:"M3 12a9 9 0 1 0 3-6.7L3 8",...l}),(0,v.jsx)(n.Path,{d:"M3 3v5h5M12 7v5l3 3",...l})]}):'leaver'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"9",cy:"8",r:"4",...l}),(0,v.jsx)(n.Path,{d:"M2 21c0-4 3-6 7-6 2 0 3.5.5 4.6 1.3M16 15l5 5M21 15l-5 5",...l})]}):'permissions'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Rect,{x:"3",y:"6",width:"18",height:"12",rx:"6",...l}),(0,v.jsx)(n.Circle,{cx:"15",cy:"12",r:"3",...l})]}):'settings'===e?(0,v.jsxs)(o.default,{width:t,height:t,viewBox:"0 0 24 24",children:[(0,v.jsx)(n.Circle,{cx:"12",cy:"12",r:"3",...l}),(0,v.jsx)(n.Path,{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1",...l})]}):(0,v.jsx)(f.CarGlyph,{name:e,size:t,colour:s})},_e.OnOff=C,_e.DeskPermissions=function(){const[e,s]=(0,t.useState)(null),[l,n]=(0,t.useState)(''),[o,d]=(0,t.useState)('level'),[c,h]=(0,t.useState)(null),[g,f]=(0,t.useState)(!1),[p,x]=(0,t.useState)(''),w=(0,t.useCallback)(async()=>{try{s(await(0,y.loadPermissions)()),n('')}catch(e){n(e.message)}},[]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{w()},0);return()=>clearTimeout(e)},[w]);const j=async(e,t)=>{f(!0),x('');const s=await e();f(!1);const l=s.ok?t:s.error??'Could not save. Try again.';x(l),I(l),s.ok&&await w()},S=(0,t.useMemo)(()=>b.DESK_LEVELS.map(t=>e?.roles.find(e=>e.key===t)).filter(Boolean),[e]);if(l)return(0,v.jsxs)(r.default,{style:{alignItems:'center',gap:10},children:[(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-error",children:l}),(0,v.jsx)(a.Button,{small:!0,kind:"secondary",label:"Try again",onPress:()=>{w()}})]});if(!e)return(0,v.jsx)(a.Muted,{center:!0,children:"Loading permissions\u2026"});const D=!!e.canEdit,L=e.staff.find(e=>e.ref===c);return(0,v.jsxs)(r.default,{testID:"desk-permissions",style:{gap:14,width:'100%',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"Switch each kind of access on or off for a whole level, or for one person. Every change saves straight away for the whole team, the server checks it on every phone and screen, and it is logged with who and when. Owners always keep full access."}),D?null:(0,v.jsx)(a.T,{center:!0,colour:m.colours.amber,testID:"dperm-readonly",children:"Only owners can change these. You can see them here."}),(0,y.permissionsLive)()?null:(0,v.jsx)(a.Muted,{center:!0,size:12,testID:"dperm-sample",children:"Sample team on this screen: nothing is saved."}),(0,v.jsxs)(a.Row,{gap:8,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"dperm-view-level",label:"By level",selected:'level'===o,onPress:()=>d('level')}),(0,v.jsx)(a.Chip,{testID:"dperm-view-person",label:"By person",selected:'person'===o,onPress:()=>d('person')})]}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"dperm-msg",children:p?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:p}):null}),'level'===o?(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:8},children:[(0,v.jsx)(a.Muted,{center:!0,size:13,children:b.LEVEL_NOTE}),(0,v.jsxs)(r.default,{role:"table",'aria-label':'Access by level',testID:"dperm-matrix",style:{borderWidth:1,borderColor:m.colours.border,borderRadius:14,overflow:'hidden'},children:[(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',backgroundColor:m.colours.surface2,borderBottomWidth:1,borderColor:m.colours.border},children:[(0,v.jsx)(r.default,{role:"columnheader",style:{flex:3,padding:10,justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Access"})}),S.map(e=>(0,v.jsx)(r.default,{role:"columnheader",style:{flex:1,padding:10,alignItems:'center',justifyContent:'center'},children:(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,children:(0,b.levelLabel)(e.key)})},e.key))]}),u.PERM_GROUPS.map(e=>(0,v.jsxs)(r.default,{children:[(0,v.jsx)(r.default,{role:"row",style:{paddingVertical:6,backgroundColor:'#14120F',borderTopWidth:1,borderColor:m.colours.border},children:(0,v.jsx)(r.default,{role:"rowheader",style:{alignItems:'center'},children:(0,v.jsx)(a.T,{size:13,weight:"semibold",colour:m.colours.goldMuted,center:!0,style:{letterSpacing:1},children:e.toUpperCase()})})}),u.PERM_CATALOG.filter(t=>t.group===e).map(e=>(0,v.jsxs)(r.default,{role:"row",style:{flexDirection:'row',alignItems:'center',borderTopWidth:1,borderColor:m.colours.border,minHeight:56},children:[(0,v.jsxs)(r.default,{role:"rowheader",style:{flex:3,paddingHorizontal:12,paddingVertical:6},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:e.label}),e.note?(0,v.jsx)(a.Muted,{size:11,center:!0,children:e.note}):null]}),S.map(t=>{const s=(0,b.levelSwitch)(t,e.key,D);return(0,v.jsx)(r.default,{role:"cell",style:{flex:1,alignItems:'center'},children:(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-${t.key}-${e.key}`,onPress:()=>{j(()=>(0,y.saveRolePerms)(t.key,(0,u.toggle)((0,u.ticks)(t.perms),e.key,!s.on)),`${(0,b.levelLabel)(t.key)}: ${e.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})},t.key)})]},e.key))]},e))]})]}):(0,v.jsxs)(r.default,{style:{width:'100%',maxWidth:1180,gap:10,alignItems:'center'},children:[(0,v.jsx)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:e.staff.map(e=>(0,v.jsx)(a.Chip,{testID:`dperm-person-${e.ref}`,label:$(e.name),sub:(0,b.levelLabel)(e.role),selected:c===e.ref,accessibilityLabel:`${e.name}, ${(0,b.levelLabel)(e.role)}${e.ownerAccess?', owner access':''}`,onPress:()=>h(e.ref)},e.ref))}),L?(0,v.jsxs)(r.default,{testID:"dperm-person",style:{width:'100%',gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{size:20,weight:"bold",colour:m.colours.gold,center:!0,accessibilityRole:"header",children:L.name.replace(' (example)','')}),(0,v.jsx)(a.Row,{gap:6,style:{justifyContent:'center'},children:L.extra.length||L.removed.length?(0,v.jsx)(a.Badge,{kind:"gold",label:"Changed just for them"}):(0,v.jsx)(a.Badge,{label:"Same as their level"})}),(0,v.jsx)(k.Grid,{min:340,gap:10,children:u.PERM_CATALOG.map(t=>{const s=(0,b.personSwitch)(L,t.key,e.me,D);return(0,v.jsxs)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:10,padding:10,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{size:14,center:!0,children:t.label}),(0,v.jsxs)(a.Muted,{size:11,center:!0,children:[t.group,s.why?` \xb7 ${s.why}`:'']})]}),(0,v.jsx)(C,{s:s,busy:g,testID:`dperm-p-${t.key}`,onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,(0,u.toggle)((0,u.ticks)(L.effective),t.key,!s.on)),`${$(L.name)}: ${t.label} switched ${s.on?'off':'on'}. Saved and logged.`)}})]},t.key)})}),D&&(L.extra.length||L.removed.length)?(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:"dperm-reset",label:"Back to their level",onPress:()=>{j(()=>(0,y.savePersonPerms)(L.ref,null),`${$(L.name)} is back to the ${(0,b.levelLabel)(L.role)} level. Saved and logged.`)}}):null,(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Temporary manager, temporary owner and cash up switches are in Settings, Staff & roles."})]}):(0,v.jsx)(a.Muted,{center:!0,children:"Pick someone to see and switch exactly what they can do."})]}),(0,v.jsxs)(r.default,{testID:"dperm-log",style:{width:'100%',maxWidth:1180,borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Changes log"}),e.log.length?e.log.slice(0,10).map(e=>(0,v.jsxs)(r.default,{accessible:!0,accessibilityLabel:`${(0,u.logWhen)(e.at)}. ${(0,u.logWords)(e)}${e.reason?`. ${e.reason}`:''}`,style:{paddingVertical:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{center:!0,size:14,children:(0,u.logWords)(e)}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[(0,u.logWhen)(e.at),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,v.jsx)(a.Muted,{center:!0,children:"No changes yet."})]})]})},_e.DeskLeavers=function(){const{meId:e}=(0,p.useCtx)(6e4),s=(0,p.useSignedIn)(),l=(0,c.useOwner)(e=>e.staff),n=(0,h.useLeavers)(e=>e.notes),[o,d]=(0,t.useState)(null),[g,y]=(0,t.useState)(''),[f,x]=(0,t.useState)(''),[w,j]=(0,t.useState)(''),C=s?.id??e,S=(s?.name??'Owner').replace(' (example)',''),D=l.filter(e=>!e.name.includes('(example)')).sort((e,t)=>e.name.localeCompare(t.name)),L=D.filter(e=>e.active),T=D.filter(e=>!e.active),M=o?l.find(e=>e.id===o.id):void 0,P=()=>{d(null),y(''),x('')},R=(e,t)=>{const s=t?(0,b.leaverBlock)(e,C):null;return(0,v.jsxs)(r.default,{testID:`leaver-row-${e.id}`,style:{flexDirection:'row',alignItems:'center',gap:12,padding:12,borderWidth:1,borderColor:m.colours.border,borderRadius:12,backgroundColor:m.colours.surface},children:[(0,v.jsxs)(r.default,{style:{flex:1},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:e.name}),(0,v.jsxs)(a.Muted,{center:!0,size:12,children:[e.job||(0,b.levelLabel)(e.role),e.temp?' \xb7 temporary':'',t?'':' \xb7 app switched off']})]}),t?s?(0,v.jsx)(r.default,{style:{maxWidth:220},children:(0,v.jsx)(a.Muted,{center:!0,size:12,children:s})}):(0,v.jsx)(a.Button,{small:!0,kind:"secondary",testID:`leaver-off-${e.id}`,label:"Switch off their app",accessibilityLabel:`Switch off ${e.name}\u2019s app`,onPress:()=>d({id:e.id,on:!1})}):(0,v.jsx)(a.Button,{small:!0,testID:`leaver-on-${e.id}`,label:"Switch back on",accessibilityLabel:`Switch ${e.name}\u2019s app back on`,onPress:()=>d({id:e.id,on:!0})})]},e.id)};return(0,v.jsxs)(r.default,{testID:"desk-leavers",style:{gap:14,width:'100%',maxWidth:1180,alignSelf:'center',alignItems:'center'},children:[(0,v.jsx)(a.Muted,{center:!0,style:{maxWidth:820},children:"When someone leaves, switch off their app. They can\u2019t sign in or access new shared data. Information already downloaded may stay on their device until it refreshes. Nothing is deleted: their hours, tips, rota history and pay records stay, and you can switch them back on."}),(0,v.jsx)(r.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',testID:"leaver-msg",children:w?(0,v.jsx)(a.T,{center:!0,colour:m.colours.goldLight,children:w}):null}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`Team with the app on (${L.length})`}),(0,v.jsx)(k.Grid,{min:420,gap:8,children:L.map(e=>R(e,!0))})]}),(0,v.jsxs)(r.default,{style:{width:'100%',gap:8},testID:"leaver-off-list",children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,colour:m.colours.gold,accessibilityRole:"header",children:`App switched off (${T.length})`}),T.length?(0,v.jsx)(k.Grid,{min:420,gap:8,children:T.map(e=>R(e,!1))}):(0,v.jsx)(a.Muted,{center:!0,children:"Nobody is switched off."})]}),(0,v.jsxs)(r.default,{testID:"leaver-log",style:{width:'100%',borderWidth:1,borderColor:m.colours.border,borderRadius:14,padding:14,gap:4,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Leaving log on this computer"}),n.length?n.slice(0,12).map(e=>(0,v.jsx)(a.Muted,{center:!0,size:13,children:`${(0,u.logWhen)(e.at)} \xb7 ${e.by} switched ${$(e.name)}\u2019s app ${e.on?'back on':'off'} \xb7 ${e.reason}`},e.id)):(0,v.jsx)(a.Muted,{center:!0,size:13,children:"No changes yet."})]}),o&&M?(0,v.jsxs)(a.Sheet,{visible:!0,onClose:P,title:o.on?`Switch ${$(M.name)}\u2019s app back on?`:`Switch off ${$(M.name)}\u2019s app?`,maxWidth:620,testID:"leaver-sheet",children:[o.on?(0,v.jsx)(a.T,{center:!0,children:`${$(M.name)} can sign in and use their app again with their own link. Their old hours and tips are all still there.`}):(0,v.jsx)(r.default,{style:{gap:6},children:(0,b.switchOffWords)($(M.name)).map(e=>(0,v.jsx)(a.T,{center:!0,children:e},e))}),o.on?null:(0,v.jsxs)(r.default,{style:{gap:8,alignItems:'center'},children:[(0,v.jsx)(a.T,{weight:"semibold",center:!0,children:"Why are they leaving?"}),(0,v.jsx)(a.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:b.LEAVE_REASONS.map(e=>(0,v.jsx)(a.Chip,{testID:`leaver-reason-${e.split(' ')[0].toLowerCase()}`,label:e,selected:g===e,onPress:()=>y(e)},e))})]}),(0,v.jsx)(a.Field,{label:o.on?'Note (optional)':'Other'===g?'Reason':'Note (optional)',value:f,onChangeText:x,testID:"leaver-note",placeholder:o.on?'e.g. Back for the summer':'e.g. Last shift Saturday'}),(0,v.jsxs)(a.Row,{gap:10,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Button,{kind:"secondary",label:"Cancel",onPress:P,testID:"leaver-cancel"}),(0,v.jsx)(a.Button,{testID:"leaver-yes",label:o.on?`Yes, switch ${$(M.name)} back on`:`Yes, switch off ${$(M.name)}\u2019s app`,disabled:!o.on&&!(0,b.leaverReasonOk)(g,f),onPress:()=>{if(!M||!o)return;if(!1===o.on&&((0,b.leaverBlock)(M,C)||!(0,b.leaverReasonOk)(g,f)))return;c.useOwner.getState().updateStaff(M.id,{active:o.on}),h.useLeavers.getState().add({staffId:M.id,name:M.name,on:o.on,at:(new Date).toISOString(),by:S,reason:o.on?f.trim()||'Back at work':(0,b.leaverReasonText)(g,f)});const e=o.on?`${$(M.name)}\u2019s app is switched back on.`:`${$(M.name)}\u2019s app is switched off. Nothing was deleted.`;j(e),I(e),P()}})]})]}):null]})},_e.DeskCoversHistory=function(){const{rid:e,today:s}=(0,p.useCtx)(6e4),l=(0,d.useBookings)(e),[n,o]=(0,t.useState)(28),[c,h]=(0,t.useState)({k:'date',d:'desc'}),u=(0,w.lastDays)(s,n+1).filter(e=>e{const t=l.filter(t=>t.date===e),s=t.filter(e=>'cancelled'!==e.status&&'noshow'!==e.status);return{date:e,bookings:s.filter(e=>!e.walkIn).length,covers:s.reduce((e,t)=>e+(t.partySize||0),0),walkIns:s.filter(e=>e.walkIn).length,noShows:t.filter(e=>'noshow'===e.status).length,cancelled:t.filter(e=>'cancelled'===e.status).length}}),g=u.map(e=>({date:e.date,value:e.covers})),y=(0,w.sortRows)(u,S.find(e=>e.key===c.k),c.d),f=u.reduce((e,t)=>e+t.covers,0);return(0,v.jsxs)(r.default,{testID:"desk-covers-history",style:{gap:14,width:'100%'},children:[(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,28,42].map(e=>(0,v.jsx)(a.Chip,{testID:`hist-days-${e}`,label:"Last "+(7===e?'7 days':28===e?'4 weeks':'6 weeks'),selected:n===e,onPress:()=>o(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:m.colours.goldLight,children:`${f} covers over ${u.length} days \xb7 ${u.reduce((e,t)=>e+t.noShows,0)} no-shows`}),(0,v.jsx)(k.Panel,{children:(0,v.jsx)(j.WideChart,{title:"Covers per day",sub:"Bookings and walk-ins that came (no-shows and cancellations left out)",points:g,fmt:e=>String(Math.round(e)),today:s,testID:"chart-covers-history",valueLabel:"Covers"})}),(0,v.jsx)(x.DataTable,{caption:"Bookings and covers by day",cols:S,rows:y,rowKey:e=>e.date,sortKey:c.k,dir:c.d,testID:"hist-days-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.date)}: ${e.bookings} bookings, ${e.covers} covers, ${e.walkIns} walk-ins, ${e.noShows} no-shows, ${e.cancelled} cancelled`}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"For one exact date, use the Look back tab."})]})},_e.DeskTemps=function(){const{today:e}=(0,p.useCtx)(6e4),s=(0,g.useSafetyView)('managers'),[l,n]=(0,t.useState)('all'),[o,d]=(0,t.useState)(14),[c,h]=(0,t.useState)({k:'at',d:'desc'}),u=(s.allPoints??s.points).filter(e=>'fridge'===e.kind||'freezer'===e.kind),y=(0,w.lastDays)(e,o)[0],f=s.entries.filter(e=>('fridge'===e.kind||'freezer'===e.kind)&&'number'==typeof(e.correctedValue??e.value)&&e.at.slice(0,10)>=y&&!e.archived&&('all'===l||e.pointId===l)).map(e=>({id:e.id,at:e.at,unit:e.name,value:e.correctedValue??e.value,ok:e.ok,by:(e.by||'').replace(' (example)',''),action:e.corrective??''})),b=(0,w.sortRows)(f,D.find(e=>e.key===c.k),c.d),j=f.filter(e=>!e.ok).length;return(0,v.jsxs)(r.default,{testID:"desk-temps",style:{gap:12,width:'100%'},children:[(0,v.jsxs)(a.Row,{gap:6,wrap:!0,style:{justifyContent:'center'},children:[(0,v.jsx)(a.Chip,{testID:"temps-unit-all",label:"All units",selected:'all'===l,onPress:()=>n('all')}),u.map(e=>(0,v.jsx)(a.Chip,{testID:`temps-unit-${e.id}`,label:e.name,sub:e.archived?'no longer used':'freezer'===e.kind?'Freezer':'Fridge',selected:l===e.id,onPress:()=>n(e.id)},e.id))]}),(0,v.jsx)(a.Row,{gap:8,style:{justifyContent:'center'},children:[7,14,28].map(e=>(0,v.jsx)(a.Chip,{testID:`temps-days-${e}`,label:`Last ${e} days`,selected:o===e,onPress:()=>d(e)},e))}),(0,v.jsx)(a.T,{center:!0,weight:"semibold",colour:j?m.colours.amber:m.colours.goldLight,testID:"temps-summary",children:f.length?`${f.length} readings \xb7 ${j?`${j} out of range`:'all in range'}`:'No fridge or freezer readings in these days'}),(0,v.jsx)(x.DataTable,{caption:"Fridge and freezer temperatures",cols:D,rows:b,rowKey:e=>e.id,sortKey:c.k,dir:c.d,testID:"temps-table",onSort:e=>h(t=>({k:e,d:t.k===e&&'desc'===t.d?'asc':'desc'})),rowLabel:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}, ${e.unit}, ${e.value} degrees, ${e.ok?'in range':'out of range'}, by ${e.by}`,empty:"No readings to show."}),(0,v.jsx)(a.Muted,{center:!0,size:12,children:"Limits for each fridge and freezer are in Settings, Food safety log."})]})};var t=_r(_d[0]),s=e(_r(_d[1])),l=e(_r(_d[2])),r=e(_r(_d[3])),n=_r(_d[4]),o=e(n),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),g=_r(_d[10]),y=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),b=_r(_d[16]),w=_r(_d[17]),j=_r(_d[18]),k=_r(_d[19]),v=_r(_d[20]);const I=e=>{try{s.default.announceForAccessibility?.(e)}catch{}},$=e=>e.replace(' (example)','').split(' ')[0];function C({s:e,onPress:t,testID:s,busy:n}){const o=e.locked||n;return(0,v.jsxs)(l.default,{testID:s,accessibilityRole:"switch",accessibilityState:{checked:e.on,disabled:o},'aria-checked':e.on,accessibilityLabel:e.spoken,disabled:o,onPress:t,style:({hovered:t,focused:s})=>({minWidth:64,minHeight:40,alignItems:'center',justifyContent:'center',borderRadius:10,backgroundColor:t||s?m.colours.tilePressed:'transparent',opacity:e.locked?.75:1}),children:[(0,v.jsx)(r.default,{style:{width:46,height:26,borderRadius:13,borderWidth:1.5,borderColor:e.on?m.colours.gold:m.colours.muted,backgroundColor:e.on?m.colours.gold:'#26231E',justifyContent:'center',paddingHorizontal:2,alignItems:e.on?'flex-end':'flex-start'},children:(0,v.jsx)(r.default,{style:{width:19,height:19,borderRadius:10,backgroundColor:e.on?'#0B0B0B':'#BBB4A6'}})}),(0,v.jsx)(a.T,{size:11,colour:e.on?m.colours.goldLight:m.colours.muted,center:!0,children:e.locked&&e.on?'Always on':e.on?'On':'Off'})]})}const S=[{key:'date',label:'Date',width:150,value:e=>e.date,text:e=>(0,w.ddmmyyyy)(e.date)},{key:'bookings',label:'Bookings',width:110,value:e=>e.bookings,numeric:!0},{key:'covers',label:'Covers',width:110,value:e=>e.covers,numeric:!0},{key:'walkIns',label:'Walk-ins',width:110,value:e=>e.walkIns,numeric:!0},{key:'noShows',label:'No-shows',width:110,value:e=>e.noShows,numeric:!0},{key:'cancelled',label:'Cancelled',width:110,value:e=>e.cancelled,numeric:!0}];const D=[{key:'at',label:'Date and time',width:170,value:e=>e.at,text:e=>`${(0,w.ddmmyyyy)(e.at.slice(0,10))} ${(0,w.ukTime)(e.at)}`},{key:'unit',label:'Fridge or freezer',width:220,value:e=>e.unit},{key:'value',label:'Reading \xb0C',width:110,value:e=>e.value,text:e=>`${e.value}\xb0C`,numeric:!0},{key:'ok',label:'In range',width:100,value:e=>e.ok?'Yes':'No'},{key:'by',label:'Checked by',width:140,value:e=>e.by},{key:'action',label:'What was done',width:240,value:e=>e.action}]},1571,[17,264,385,85,780,777,858,876,1572,915,1215,1466,804,1562,1057,1569,1573,1567,1570,1568,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLeavers",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),s=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e};const c=(0,t.create)()((0,s.persist)(e=>({notes:[],add:t=>e(e=>({notes:[{...t,id:`lv-${Date.now()}-${Math.random().toString(36).slice(2,7)}`},...e.notes].slice(0,200)}))}),{name:'covercharge-desk-leavers-v1',storage:(0,s.createJSONStorage)(()=>o.default)}))},1572,[831,834,824]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESK_LEVELS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"LEVEL_NOTE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"levelLabel",{enumerable:!0,get:function(){return s}}),e.levelSwitch=function(t,o,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=s(t.key),h=t.owner||(0,n.has)(t.perms,o),u=t.owner?'Owners always have everything':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},e.personSwitch=function(t,o,s,c){const f=n.PERM_CATALOG.find(n=>n.key===o),l=t.name.split(' ')[0],h=(0,n.has)(t.effective,o),u='owner'===t.role?'Owners always have everything':t.ownerAccess||t.base.includes('*')?'Owner access: everything':t.ref===s?'You can\u2019t change your own access':c?void 0:'Only owners can change this';return{on:h,locked:!!u,why:u,spoken:`${l}: ${f?.label??o}. ${h?'On':'Off'}${u?`. ${u}`:''}.`}},Object.defineProperty(e,"LEAVE_REASONS",{enumerable:!0,get:function(){return c}}),e.leaverBlock=function(n,t){return'owner'===n.role?'Owners can\u2019t be switched off here.':n.ownerAccess?'Has owner access. Take that off in Staff & roles first.':n.id===t?'You can\u2019t switch off your own app.':n.name.includes('(example)')?'Sample person.':null},Object.defineProperty(e,"leaverReasonOk",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"leaverReasonText",{enumerable:!0,get:function(){return l}}),e.switchOffWords=function(n){return[`${n}\u2019s access to the shared app is switched off. They can\u2019t sign in or get new data.`,"Nothing is deleted. Their hours, tips, rota history and pay records are all kept.","Already downloaded information may stay on their device until it refreshes. You can switch access back on at any time."]};var n=r(d[0]);const t=['owner','manager','supervisor','head_chef','staff'],o='Front of house, kitchen porters and other team members are the Staff level. To change one person, use By person.',s=t=>n.ROLE_LABEL[t]??t;const c=['Left the job','End of the season','Temporary work finished','Dismissed','Other'];const f=(n,t)=>!!n&&('Other'!==n||t.trim().length>=3),l=(n,t)=>('Other'===n?t.trim():t.trim()?`${n}: ${t.trim()}`:n).slice(0,200)},1573,[915]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopInstallPage=function(){const e='undefined'!=typeof navigator?navigator.userAgent:'',s=(0,o.isMacUa)(e,'undefined'!=typeof navigator?navigator.platform:''),u=(0,o.browserOf)(e),[,p]=(0,t.useState)(0),[f,j]=(0,t.useState)('');return(0,t.useEffect)(()=>(0,o.onInstallChange)(()=>p(e=>e+1)),[]),(0,c.jsxs)(n.default,{style:{gap:12},testID:"desk-install-page",children:[(0,o.installedWindow)()?(0,c.jsx)(l.T,{center:!0,colour:i.colours.goldLight,children:"CoverCharge for desktop is installed on this computer."}):(0,o.canPromptInstall)()?(0,c.jsxs)(n.default,{style:{alignItems:'center',gap:6},children:[(0,c.jsx)(l.Button,{label:"Install now",testID:"desk-install-now",onPress:async()=>{const e=await(0,o.promptInstall)();j(e?'Installed. CoverCharge opens in its own window.':'Not installed. You can do it later from here.')}}),f?(0,c.jsx)(n.default,{'aria-live':'polite',children:(0,c.jsx)(l.Muted,{center:!0,children:f})}):null]}):(0,c.jsx)(h,{head:"On this computer",lines:(0,o.installSteps)(u,s)}),(0,c.jsx)(h,{head:"Windows PC: Chrome or Edge",lines:[...(0,o.installSteps)('edge',!1).slice(0,1),(0,o.installSteps)('chrome',!1)[0],'Click Install, then pin CoverCharge to the taskbar.']}),(0,c.jsx)(h,{head:"Mac: Chrome, Edge or Safari",lines:[(0,o.installSteps)('chrome',!0)[0],(0,o.installSteps)('safari',!0)[0],'Safari\u2019s Dock app keeps its own sign-in: sign in once inside it.']}),(0,c.jsx)(l.Muted,{center:!0,children:"It is the same CoverCharge as the phone apps: same sign-in, same data and the same permissions, checked by the server. It updates itself; there is nothing to download or keep up to date."})]})};var e,t=r(d[0]),s=r(d[1]),n=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),i=r(d[3]),o=r(d[4]),c=r(d[5]);function h({head:e,lines:t}){return(0,c.jsxs)(n.default,{style:{gap:6,padding:14,borderWidth:1,borderColor:i.colours.border,borderRadius:12,backgroundColor:i.colours.surface},children:[(0,c.jsx)(n.default,{role:"heading",'aria-level':3,children:(0,c.jsx)(l.T,{weight:"semibold",center:!0,colour:i.colours.goldLight,children:e})}),(0,c.jsx)(n.default,{role:"list",children:t.map((e,t)=>(0,c.jsx)(n.default,{role:"listitem",style:{paddingVertical:3},children:(0,c.jsx)(l.T,{size:14,center:!0,children:`${t+1}. ${e}`})},t))})]})}},1574,[17,85,777,804,1575,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canPromptInstall",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"onInstallChange",{enumerable:!0,get:function(){return s}}),_e.promptInstall=async function(){if(!e)return!1;const n=e;e=null,await n.prompt();const o=await n.userChoice;return t.forEach(e=>e()),'accepted'===o.outcome},_e.installedWindow=function(){try{return!!n()?.matchMedia?.('(display-mode: standalone)').matches||!!n()?.navigator?.standalone}catch{return!1}},_e.browserOf=function(e){return/Edg\//.test(e)?'edge':/Firefox\//.test(e)?'firefox':/Chrome\//.test(e)||/CriOS/.test(e)?'chrome':/Safari\//.test(e)&&/Version\//.test(e)?'safari':'other'},Object.defineProperty(_e,"isMacUa",{enumerable:!0,get:function(){return l}}),_e.installSteps=function(e,t){return'chrome'===e?["Click the install icon at the right of the address bar (a small screen with an arrow), or the \u22ee menu, then \u201cCast, save and share\u201d \u203a \u201cInstall page as app\u2026\u201d.",'Click Install. CoverCharge opens in its own window and is added to your '+(t?'Applications folder and Launchpad.':'Start menu. Right-click it in the taskbar to pin it.')]:'edge'===e?['Click the \u22ef menu, then \u201cApps\u201d \u203a \u201cInstall this site as an app\u201d.','Click Install. CoverCharge opens in its own window. Pin it to the taskbar or Start when Edge asks.']:'safari'===e?['In the menu bar, choose File \u203a Add to Dock (macOS Sonoma 14 or later).','Click Add. Open CoverCharge from the Dock, then sign in once inside it (the Dock app keeps its own sign-in).']:'firefox'===e?['Firefox can\u2019t install web apps. It works fine in a normal tab: bookmark this page.','To get it in its own window, open this page in Chrome or Edge and install it there.']:['Open this page in Chrome or Edge (Windows or Mac), or Safari 17 or later on a Mac, to install it.']};let e=null;const t=new Set,n=()=>'undefined'!=typeof window?window:void 0;n()?.addEventListener&&(n().addEventListener('beforeinstallprompt',n=>{n.preventDefault(),e=n,t.forEach(e=>e())}),n().addEventListener('appinstalled',()=>{e=null,t.forEach(e=>e())}));const o=()=>!!e,s=e=>(t.add(e),()=>{t.delete(e)});const l=(e,t="")=>/Mac/i.test(t)||/Macintosh|Mac OS X/.test(e)},1575,[]); +__d(function(_g,_r,_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:h,today:O,now:I,meId:N,me:X}=(0,A.useCtx)(3e4);(0,x.useTipsPosted)(e,O);const Z=(0,A.useSignedIn)();(0,m.useSoldOutLink)(!0,(Z?.name??X).replace(' (example)',''));const[q,J]=(0,s.useState)({kind:'tab',tab:'home'}),[Q,Y]=(0,s.useState)(''),ee=(0,s.useRef)(null);(0,s.useEffect)(()=>{(0,A.ensureAttendance)(O,I),(0,D.ensureChat)(I)},[O]),globalThis.__ccNow=I.getTime();const te=(0,s.useCallback)((e,t=null)=>{if('more'===e&&t){const e=V[t];return void J(e?{kind:'edit',id:e}:{kind:'page',id:t})}J('more'===e?{kind:'page',id:'help'}:{kind:'tab',tab:e})},[]);(0,s.useEffect)(()=>(C.useVoiceNav.setState({go:te}),()=>C.useVoiceNav.setState({go:null})),[te]),(0,s.useEffect)(()=>{T.PITCH&&(globalThis.__pitchGo=te,globalThis.__deskGo=e=>J(e))},[te]),(0,v.useAlertWatcher)(e,{nag:'staff'!==h}),(0,w.useScheduledNotices)({rid:e,staffId:Z?.id??'',name:X,onOpen:e=>'bookings'===e?te('bookings'):'chat'===e?te('chat'):te('more',e)}),(0,y.useOffRotaAlerts)({enabled:'staff'!==h&&!!Z});const ae=(0,s.useMemo)(()=>[...$,...F].map(e=>e.s),[]);(0,s.useEffect)(()=>{const e=e=>{if(!(e.metaKey||e.ctrlKey))return;const t=e.key.toLowerCase();if('k'===t)return e.preventDefault(),void ee.current?.focus();if(/^[1-9]$/.test(e.key)&&!e.shiftKey){const t=ae[Number(e.key)-1];return void(t&&(e.preventDefault(),J(t)))}if('z'===t&&!U(e.target)){const t=(0,z.activeUndo)();if(!t)return;e.preventDefault(),e.shiftKey?t.redo():t.undo()}if('y'===t&&!U(e.target)){const t=(0,z.activeUndo)();t&&(e.preventDefault(),t.redo())}};return window.addEventListener('keydown',e),()=>window.removeEventListener('keydown',e)},[ae]);const se=B.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(h))&&!V[e.id]),ne=(0,s.useMemo)(()=>{const e=Q.trim().toLowerCase(),t={};return se.filter(t=>!e||`${t.title} ${t.sub}`.toLowerCase().includes(e)).forEach(e=>{(t[e.group]??=[]).push(e)}),t},[se,Q]),oe=$.filter(e=>'tab'!==e.s.kind||'forecast'!==e.s.tab||p.CAN.forecasts(h)),re=p.CAN.forecasts(h)?F:F.filter(e=>'rota'===e.s.id),ie='page'===q.kind?(0,B.pageFor)(q.id):void 0,le='tab'===q.kind?$.find(e=>K(e.s,q))?.label:'edit'===q.kind?F.find(e=>K(e.s,q))?.label:ie?.title,de='tab'===q.kind?$.find(e=>K(e.s,q))?.tip:'page'===q.kind?`${ie?.sub??''}. Press ${(0,_.CMD)()}K to jump to any page.`:'',ue=({label:e,s:t,n:a})=>{const s=K(t,q);return(0,W.jsxs)(n.default,{accessibilityRole:"button",accessibilityState:{selected:s},testID:`side-${e.toLowerCase().replace(/[^a-z]+/g,'-')}`,onPress:()=>J(t),style:({hovered:e})=>({flexDirection:'row',alignItems:'center',paddingVertical:7,paddingHorizontal:10,borderRadius:8,backgroundColor:s?S.colours.goldTint:e?S.colours.tilePressed:'transparent',borderLeftWidth:3,borderLeftColor:s?S.colours.gold:'transparent'}),children:[(0,W.jsx)(f.T,{size:14,weight:s?'semibold':'regular',colour:s?S.colours.gold:S.colours.text,style:{flex:1},numberOfLines:1,children:e}),a?(0,W.jsxs)(f.T,{size:11,colour:S.colours.muted,children:[(0,_.CMD)(),a]}):null]})},ce=({t:e})=>(0,W.jsx)(f.T,{size:11,weight:"semibold",colour:S.colours.goldMuted,style:{letterSpacing:1,marginTop:14,marginBottom:4,paddingHorizontal:10},children:e.toUpperCase()}),be='owner'===h?'OWNER':'manager'===h?'MANAGER':'STAFF';return(0,W.jsxs)(i.SafeAreaView,{style:{flex:1,backgroundColor:S.colours.bg},testID:"desktop-shell",children:[(0,W.jsxs)(r.default,{style:{flex:1,flexDirection:'row'},children:[(0,W.jsxs)(r.default,{style:{width:250,backgroundColor:(0,t.soutersSurface)('#0E0E0E'),borderRightWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(r.default,{style:{padding:12,gap:6,borderBottomWidth:1,borderColor:S.colours.border},children:[(0,W.jsxs)(f.Row,{gap:10,children:[(0,W.jsx)(u.RestaurantLogo,{rid:e,size:40}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(u.VenueName,{name:c.name}),(0,W.jsx)(f.Row,{gap:6,children:(0,W.jsx)(l.AppBadge,{label:be})})]})]}),(0,W.jsx)(u.PoweredBy,{}),(0,W.jsx)(a.TextInput,{ref:ee,testID:"side-filter",value:Q,onChangeText:Y,placeholder:`Find a page (${(0,_.CMD)()}K)`,placeholderTextColor:S.colours.muted,style:[f.styles.input,{paddingVertical:6,fontSize:13}]})]}),(0,W.jsxs)(o.default,{contentContainerStyle:{padding:8,paddingBottom:30},children:[Q?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ce,{t:"Run the day"}),oe.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:t+1},e.label)),(0,W.jsx)(ce,{t:"Drag-and-drop editors"}),re.map((e,t)=>(0,W.jsx)(ue,{label:e.label,s:e.s,n:oe.length+t+1},e.label))]}),Object.entries(ne).map(([e,t])=>(0,W.jsxs)(r.default,{children:[(0,W.jsx)(ce,{t:e}),t.map(e=>(0,W.jsx)(ue,{label:e.title,s:{kind:'page',id:e.id}},e.id))]},e))]})]}),(0,W.jsxs)(r.default,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(r.default,{style:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:20,paddingVertical:10,borderBottomWidth:1,borderColor:S.colours.border},children:(0,W.jsxs)(r.default,{style:{flex:1},children:[(0,W.jsx)(r.default,{testID:"desk-title",children:(0,W.jsx)(f.T,{size:24,weight:"bold",children:le??''})}),(0,W.jsxs)(f.Muted,{size:12,children:[Z?`Signed in as ${Z.name} \xb7 ${p.ROLE_LABEL[h]}`:`Preview \xb7 ${p.ROLE_LABEL[h]}`," \xb7 ",c.name]})]})}),(0,W.jsxs)(r.default,{style:{flex:1,padding:16,gap:10,minHeight:0},children:[de?(0,W.jsx)(H.Tip,{children:de}):null,'edit'===q.kind?(0,W.jsx)(G,{id:q.id,rid:e,me:X,role:'owner'===h?'owner':'manager',today:O,venue:c.name}):(0,W.jsxs)(o.default,{style:{flex:1},contentContainerStyle:{gap:12,paddingBottom:60,maxWidth:1100},keyboardShouldPersistTaps:"handled",children:['tab'===q.kind&&'home'===q.tab?(0,W.jsx)(L.Dashboard,{go:te}):null,'tab'===q.kind&&'orders'===q.tab?(0,W.jsx)(P.Orders,{}):null,'tab'===q.kind&&'bookings'===q.tab?(0,W.jsx)(E.Bookings,{}):null,'tab'===q.kind&&'forecast'===q.tab?(0,W.jsx)(R.Forecasts,{go:te}):null,'tab'===q.kind&&'chat'===q.tab?(0,W.jsx)(D.Chat,{go:te}):null,ie?(0,W.jsx)(ie.C,{go:te}):'page'===q.kind?(0,W.jsx)(f.Muted,{children:"That page isn\u2019t available for your role."}):null]})]})]})]}),(0,W.jsx)(j.SeatAllergenReminder,{rid:e}),'staff'!==h?(0,W.jsx)(g.PrintHost,{rid:e}):null,'staff'!==h?(0,W.jsx)(b.AlertHost,{variant:"managers",rid:e,me:X,onOpen:e=>te('takeaway'===e.kind?'orders':'email'===e.kind||'test'===e.kind?'more':'bookings','email'===e.kind||'test'===e.kind?'notifications':null)}):null,(0,W.jsx)(M.OnboardingHost,{go:te}),(0,W.jsx)(k.CoachHost,{})]})};var t=_r(d[0]),a=_r(d[1]),s=_r(d[2]),n=e(_r(d[3])),o=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]),g=_r(d[11]),f=_r(d[12]),h=_r(d[13]),p=_r(d[14]),m=_r(d[15]),x=_r(d[16]),k=_r(d[17]),j=_r(d[18]),y=_r(d[19]),w=_r(d[20]),C=_r(d[21]),v=_r(d[22]),T=_r(d[23]),S=_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]),P=_r(d[31]),B=_r(d[32]);_r(d[33]);var O=_r(d[34]),_=_r(d[35]),z=_r(d[36]),I=_r(d[37]),N=_r(d[38]),H=_r(d[39]),W=_r(d[40]);const $=[{label:'Today',s:{kind:'tab',tab:'home'},tip:'Tonight\u2019s Covers, bookings and orders at a glance. Use Find a page at the top of the sidebar to jump anywhere.'},{label:'Orders',s:{kind:'tab',tab:'orders'},tip:'New takeaway and table orders land here first.'},{label:'Bookings',s:{kind:'tab',tab:'bookings'},tip:'Bookings that need a yes or no are marked in amber.'},{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.'}],F=[{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:''}],V={tableplan:'plan',menu:'menu',rota:'rota',branding:'brand'},K=(e,t)=>e.kind===t.kind&&('tab'===e.kind?e.tab===t.tab:e.id===t.id),U=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable};function G({id:e,rid:t,me:a,role:n,today:o,venue:i}){const l=(0,h.usePlan)(t),[u,b]=(0,s.useState)(0),[g,p]=(0,s.useState)('');return'menu'===e?(0,W.jsx)(I.MenuEditor,{rid:t,me:a,role:n}):'rota'===e?(0,W.jsx)(N.RotaEditor,{today:o}):'brand'===e?(0,W.jsx)(O.BrandEditor,{rid:t}):(0,W.jsxs)(r.default,{style:{flex:1,gap:8,minHeight:0},testID:"desk-plan",children:[(0,W.jsxs)(H.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,_.CMD)(),"Z undoes, then Save."]}),g?(0,W.jsx)(f.T,{size:13,colour:S.colours.goldLight,children:g}):null,(0,W.jsx)(r.default,{style:{flex:1,minHeight:0,borderWidth:1,borderColor:S.colours.border,borderRadius:12,overflow:'hidden'},children:(0,W.jsx)(c.PlanDesigner,{initial:l,venue:i,mode:"managers",startStep:"arrange",onSave:e=>{h.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)})]})}},1576,[813,812,17,385,278,85,19,1363,857,1367,1230,1395,777,998,876,891,1032,1482,1087,1086,1084,1490,1232,880,804,1420,1161,1057,1433,1484,1475,1486,1459,1488,1577,1556,1579,1581,1583,1580,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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])},1577,[17,278,85,1503,857,777,876,814,1460,804,1578,1579,1580,8]); +__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)})},1578,[]); +__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},1579,[17]); +__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})},1580,[17,85,777,804,8]); +__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."})]})]})}},1581,[812,17,85,777,860,816,891,893,894,845,867,1153,804,1578,1579,1580,1582,8]); +__d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reorder=function(t,n,i,f){const c=t.filter(t=>t.section===i&&t.id!==n).map(t=>t.id),o=f?c.indexOf(f):-1;return c.splice(o<0?c.length:o,0,n),c.map((t,n)=>({id:t,sort:10*(n+1)}))},e.moveSection=function(t,n,i){const f=t.filter(t=>t!==n),c=i?f.indexOf(i):-1;return f.splice(c<0?f.length:c,0,n),f},e.moveShift=function(n,i,f,c,o,s){const u=n.find(t=>t.id===i);if(!u)return n;if(!o&&u.staffId===f&&u.date===c)return n;const l={...u,staffId:f,date:c,day:(0,t.weekdayOf)(c)};return o?[...n,{...l,id:s(),published:!1,changed:!1}]:n.map(t=>t.id===i?{...l,changed:!!u.published||u.changed}:t)};var t=r(d[0])},1582,[876]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.RotaEditor=function({today:e}){const j=(0,i.useOwner)(e=>e.staff).filter(e=>e.active),S=(0,i.useOwner)(e=>e.shifts),[k,D]=(0,t.useState)((0,i.mondayOfDate)(e)),$=(0,h.useDateCalendar)(),[v,w]=(0,t.useState)(null),[B,O]=(0,t.useState)(''),P=(0,c.useHistory)(()=>i.useOwner.getState().shifts,e=>i.useOwner.getState().setShifts(e),'rota change'),I=x.map((e,t)=>(0,i.addDays)(k,t)),T=(e,t,o)=>{e.preventDefault(),w(null);const d=(0,u.readDrag)(e);if('shift'!==d?.kind)return;const s=S.find(e=>e.id===d.id);if(!s)return;const n=!!e.altKey,c=j.find(e=>e.id===t)?.name??'';(n||s.staffId!==t||s.date!==o)&&(S.some(e=>e.staffId===t&&e.date===o&&e.id!==s.id&&e.starte.date>=k&&e.date<=I[6]),z=_.filter(e=>!e.published||e.changed).length;return(0,b.jsxs)(d.default,{style:{flex:1,gap:10},testID:"desk-rota",children:[(0,b.jsx)(f.Tip,{children:"Drag a shift to another day or person. Hold Option (Alt) while you drop to copy it instead. Nothing goes to staff until you press Publish."}),(0,b.jsxs)(s.Row,{gap:8,children:[(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"\u2039 Week before",onPress:()=>D((0,i.addDays)(k,-7))}),(0,b.jsxs)(s.T,{weight:"semibold",children:["Week of ",new Date(k+'T12:00:00').toLocaleDateString('en-GB',{day:'numeric',month:'long'})]}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Next week \u203a",onPress:()=>D((0,i.addDays)(k,7))}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",testID:"desk-rota-cal",label:"Calendar",accessibilityLabel:"Pick a date from the calendar",onPress:$.openCal}),(0,b.jsx)(h.AppDateCalendar,{visible:$.calOpen,today:e,day:k,idPrefix:"desk-rota-cal",onClose:$.closeCal,onDay:t=>D((0,i.mondayOfDate)(t??e))}),(0,b.jsx)(d.default,{style:{flex:1}}),B?(0,b.jsx)(s.T,{size:13,colour:n.colours.goldLight,children:B}):null,(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Undo",disabled:!P.canUndo,onPress:P.undo,testID:"rota-undo"}),(0,b.jsx)(s.Button,{small:!0,kind:"secondary",label:"Redo",disabled:!P.canRedo,onPress:P.redo,testID:"rota-redo"}),(0,b.jsx)(s.Button,{small:!0,label:z?`Publish (${z})`:'Published',disabled:!z,onPress:()=>{P.record('published the week');const e=i.useOwner.getState().publishWeek(k);O(`${e} shifts published.`)},testID:"rota-publish"})]}),(0,b.jsx)("div",{style:(0,f.box)({flex:1,overflow:'auto',border:`1px solid ${n.colours.border}`,borderRadius:12}),"data-testid":"rota-grid",children:(0,b.jsxs)("div",{style:(0,f.box)({display:'grid',gridTemplateColumns:"180px repeat(7, minmax(110px, 1fr))",minWidth:960}),children:[(0,b.jsx)("div",{style:(0,f.box)({position:'sticky',top:0,background:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,zIndex:1})}),I.map((t,o)=>(0,b.jsxs)("div",{style:(0,f.box)({position:'sticky',top:0,zIndex:1,background:t===e?n.colours.goldTint:n.colours.surface,padding:8,borderBottom:`1px solid ${n.colours.border}`,fontFamily:'Poppins_600SemiBold',fontSize:13,color:t===e?n.colours.gold:n.colours.text}),children:[x[o]," ",Number(t.slice(8))]},t)),j.map(e=>(0,b.jsxs)(o.default.Fragment,{children:[(0,b.jsxs)("div",{style:(0,f.box)({padding:8,borderBottom:`1px solid ${n.colours.hairline}`,fontSize:13}),children:[(0,b.jsx)("div",{style:(0,f.box)({fontFamily:'Poppins_600SemiBold'}),children:e.name}),(0,b.jsx)("div",{style:(0,f.box)({fontSize:11,color:n.colours.muted}),children:e.job})]}),I.map(t=>{const o=`${e.id}|${t}`,d=_.filter(o=>o.staffId===e.id&&o.date===t);return(0,b.jsx)("div",{"data-testid":`rota-cell-${e.id}-${t}`,onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=e.altKey?'copy':'move',w(o)},onDragLeave:()=>w(null),onDrop:o=>T(o,e.id,t),style:(0,f.box)({padding:5,minHeight:54,borderBottom:`1px solid ${n.colours.hairline}`,borderLeft:`1px solid ${n.colours.hairline}`,background:v===o?n.colours.accentBg:void 0,outline:v===o?`2px dashed ${n.colours.gold}`:void 0,outlineOffset:-3}),children:d.map(e=>(0,b.jsxs)("div",{draggable:!0,onDragStart:t=>(0,u.dragData)(t,'shift',e.id),"data-testid":`rota-shift-${e.id}`,title:e.note??'',style:(0,f.box)({cursor:'grab',userSelect:'none',borderRadius:8,padding:'4px 6px',marginBottom:4,fontSize:12,fontFamily:'Poppins_600SemiBold',background:e.published&&!e.changed?n.colours.gold:n.colours.goldTint,color:e.published&&!e.changed?n.colours.onGold:n.colours.goldLight,border:`1px solid ${n.colours.accentBorder}`}),children:[(0,l.fmtH)(e.start),"\u2013",(0,l.fmtH)(e.end),!e.published||e.changed?' \u2022':'']},e.id))},o)})]},e.id))]})}),(0,b.jsx)(s.Muted,{size:12,children:"Solid gold = published. Outlined with a dot = not yet published (new or changed)."})]})};var t=r(_d[0]),o=e(t),d=e(r(_d[1])),s=r(_d[2]),i=r(_d[3]),l=r(_d[4]),n=r(_d[5]),u=r(_d[6]),c=r(_d[7]),f=r(_d[8]),h=r(_d[9]),p=r(_d[10]),b=r(_d[11]);const x=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],y=()=>`sh-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`},1583,[17,85,777,876,1060,804,1578,1579,1580,1051,1582,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1584,[13,17,856,1585,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1585,[1460,1586,813,912,1072,1512,1209,1210,1028,1025,1026,1513,1547,1515,1153,891,978,1587,975,880,1031,1032,1496,914,1008,915,17,1155,1241,1245,1203,356,385,278,85,409,19,777,857,876,804,1161,1420,1066,1084,1086,1081,1027,1010,1057,1506,1501,1528,1588,1428,920,219,1246,1182,1188,1458,1202,1199,1483,1185,878,1212,1213,884,776,899,8]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1586,[17,85,777,1057,899,8]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1587,[219,976]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ManagerFeaturesNote=function(){return(0,j.jsxs)(a.default,{testID:"manager-features-banner",style:{borderWidth:1,borderColor:b.colours.gold,borderRadius:12,padding:10,gap:4},children:[(0,j.jsx)(d.T,{weight:"semibold",colour:b.colours.gold,children:"Manager features are on"}),(0,j.jsx)(d.Muted,{children:"Open Me \u203a Manager features for bookings, tables, blocks, allergy checks, stock, who\u2019s clocked in and shift swaps."})]})},_e.ManagerFeaturesAbout=function(){return(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"semibold",children:"What manager features include"}),c.SHIFT_MANAGER_FEATURES.map(e=>(0,j.jsxs)(d.T,{size:14,children:["\u2022 ",e]},e)),(0,j.jsxs)(d.Muted,{children:["Not included: ",c.SHIFT_MANAGER_EXCLUDED_WORDS,". Those stay in the Managers app."]})]})},_e.ClockOverview=function({today:e,now:t}){const s=(0,o.useOwner)(e=>e.staff),n=(0,o.useOwner)(e=>e.attendance).filter(t=>t.date===e&&t.in),r=e=>x(s.find(t=>t.id===e)?.name)||'Team member',h=n.filter(e=>!e.out).sort((e,t)=>(e.in??'').localeCompare(t.in??'')),c=n.filter(e=>e.out).sort((e,t)=>(e.out??'').localeCompare(t.out??'')),u=e=>(e.breaks??[]).some(e=>!e.end);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"clock-overview",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Clocked in now (",h.length,")"]}),h.length?h.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:["In at ",(0,l.hm)(new Date(e.in)),u(e)?' \xb7 on a break':'',!1===e.inSite?' \xb7 clocked in away from the venue':'']})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody is clocked in right now."}),(0,j.jsxs)(d.T,{weight:"semibold",children:["Finished today (",c.length,")"]}),c.length?c.map(e=>(0,j.jsxs)(d.Card,{children:[(0,j.jsx)(d.T,{weight:"medium",children:r(e.staffId)}),(0,j.jsxs)(d.Muted,{children:[(0,l.hm)(new Date(e.in))," to ",(0,l.hm)(new Date(e.out))]})]},e.id)):(0,j.jsx)(d.Muted,{children:"Nobody has clocked out yet today."}),(0,j.jsxs)(d.Muted,{children:["Read only. To change someone\u2019s clock record, ask a manager in the Managers app. Checked at ",(0,l.hm)(t),"."]})]})},_e.TablesToClear=function({rid:e}){const s=(0,r.useFloor)(t=>t.live[e])??{},n=Object.entries(s).filter(([,e])=>e?.dirty).map(([e])=>e).sort((e,t)=>e.localeCompare(t,'en',{numeric:!0}));return(0,j.jsx)(a.default,{style:{gap:8},testID:"tables-to-clear",children:n.length?n.map(s=>(0,j.jsx)(d.Card,{children:(0,j.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(d.T,{weight:"semibold",children:(0,t.tableNumbers)(s)}),(0,j.jsx)(d.Button,{small:!0,kind:"success",label:"Mark cleared",accessibilityLabel:`Mark table ${s} cleared, table free`,testID:`clear-${s}`,onPress:()=>{r.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),(0,w.notify)({id:`clear-${s}`,title:`${(0,t.tableNumbers)(s)} is free`,timeoutMs:4e3})}})]})},s)):(0,j.jsx)(d.Muted,{children:"No tables need clearing."})})},_e.SwapApprovals=function({today:e,me:t}){const n=(0,o.useOwner)(e=>e.staff),r=(0,o.useOwner)(e=>e.shifts),y=(0,o.useOwner)(e=>e.swaps),[M,k]=(0,s.useState)(null),[I,v]=(0,s.useState)(null),[T,S]=(0,s.useState)(!1),C=e=>x(n.find(t=>t.id===e)?.name)||'Team member',D=(()=>{const t=(0,l.parseYmd)(e);return t.setDate(t.getDate()+13),t})(),N=r.filter(t=>{return!1!==t.published&&t.date>=e&&(0,l.parseYmd)(t.date)<=D&&(s=t.staffId,!('owner'===n.find(e=>e.id===s)?.role));var s}).sort((e,t)=>e.date.localeCompare(t.date)||e.start-t.start),O=e=>`${(0,l.niceDate)((0,l.parseYmd)(e.date))}, ${(0,h.fmtH)(e.start)} to ${(0,h.fmtH)(e.end)}`,R=async(e,s,n,a)=>{S(!0);const d=await(0,u.approveShiftSwap)(e.id,s,n);S(!1),d.ok?(o.useOwner.setState(t=>({shifts:t.shifts.map(t=>t.id===e.id?{...t,staffId:s}:t)})),a&&o.useOwner.getState().setSwap(a,'approved'),(0,w.notify)({id:'swap-ok',title:'Shift changed',body:`${C(e.staffId)}\u2019s shift on ${O(e)} is now ${C(s)}\u2019s. Approved by ${x(t)}.`,timeoutMs:6e3}),k(null),v(null)):(0,w.notify)({id:'swap-fail',title:'Not changed',body:d.message,timeoutMs:6e3})},$=y.filter(e=>'open'===e.status);return(0,j.jsxs)(a.default,{style:{gap:10},testID:"swap-approvals",children:[(0,j.jsxs)(d.T,{weight:"semibold",children:["Requests (",$.length,")"]}),$.length?$.map(e=>{const t=r.find(t=>t.id===e.shiftId);return(0,j.jsxs)(d.Card,{children:[(0,j.jsxs)(d.T,{weight:"medium",children:[C(e.fromId)," \xb7 ",'cover'===e.kind?'needs cover':'swap']}),(0,j.jsxs)(d.Muted,{children:[t?O(t):'Shift not found',e.toId?` \xb7 to ${C(e.toId)}`:'',e.note?` \xb7 ${e.note}`:'']}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{small:!0,label:"Approve",disabled:!t||!e.toId||T||!(0,p.canSwapWith)(n.find(t=>t.id===e.fromId),n.find(t=>t.id===e.toId),f.VENUE_RID),onPress:()=>t&&e.toId&&R(t,e.toId,e.kind,e.id)}),(0,j.jsx)(d.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>o.useOwner.getState().setSwap(e.id,'declined')})]})]},e.id)}):(0,j.jsx)(d.Muted,{children:"No open requests on this phone. Swap requests made on other phones aren\u2019t shared yet, so if someone asks you in person, use Give a shift to someone else below."}),(0,j.jsx)(d.T,{weight:"semibold",children:"Give a shift to someone else"}),M?(0,j.jsxs)(d.Card,{highlight:b.colours.gold,children:[(0,j.jsxs)(d.T,{weight:"semibold",children:[C(M.staffId)," \xb7 ",O(M)]}),(0,j.jsx)(d.Muted,{children:"Who takes it? Only someone they are allowed to swap with."}),(0,j.jsx)(d.Row,{wrap:!0,gap:6,children:(0,c.swapTargets)(n,M.staffId,f.VENUE_RID).map(e=>(0,j.jsx)(d.Chip,{label:x(e.name),selected:I===e.id,onPress:()=>v(e.id)},e.id))}),(0,j.jsxs)(d.Row,{gap:6,children:[(0,j.jsx)(d.Button,{label:"Approve",disabled:!I||T,onPress:()=>I&&R(M,I,'swap'),testID:"swap-give"}),(0,j.jsx)(d.Button,{kind:"secondary",label:"Cancel",onPress:()=>{k(null),v(null)}})]})]}):N.length?N.map(e=>(0,j.jsxs)(d.Card,{onPress:()=>{k(e),v(null)},children:[(0,j.jsx)(d.T,{weight:"medium",children:C(e.staffId)}),(0,j.jsx)(d.Muted,{children:O(e)})]},e.id)):(0,j.jsx)(d.Muted,{children:"No published shifts in the next two weeks."}),(0,j.jsx)(d.Banner,{kind:"info",children:"Approving moves the shift on the rota for everyone and records who approved it. Writing or publishing the rota stays in the Managers app."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=(e=n)&&e.__esModule?e:{default:e},d=_r(_d[3]),o=_r(_d[4]),r=_r(_d[5]),l=_r(_d[6]),h=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),f=_r(_d[11]),w=_r(_d[12]),b=_r(_d[13]),j=_r(_d[14]);const x=e=>(e??'').replace(' (example)','')},1588,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(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]})}},1589,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1590,[1453,899,778,1414,1591,995,13,1618,479,17,368,319,219,24,85,805,857,1065,856,1620,19,858,998,876,804,1428,920,988,1621,1622,1028,1104,880,1008,914,1624,1384,8,1625,1626,1627,1628]); +__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])},1591,[1592,1615,1617]); +__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)}}},1592,[198,1593,1596,1610,1611,1612,1613,1614]); +__d(function(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}},1593,[198,1594]); +__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}},1594,[1595]); +__d(function(g,r,i,a,m,e,d){},1595,[]); +__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)}},1596,[1597,198,1593,1610,1611]); +__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]}})})},1597,[1598,1599,1609]); +__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()}})}},1598,[1599,1603,1608]); +__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}}},1599,[198,355,1600,1604,1605,1606,1607,1603,1608]); +__d(function(g,r,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}},1600,[198,1601,322,263,1602,1603]); +__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])},1601,[487]); +__d(function(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}}},1602,[198,322]); +__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},1603,[]); +__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}},1604,[]); +__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}},1605,[]); +__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])},1606,[1604]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1607,[]); +__d(function(g,r,i,a,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},1608,[355,1602]); +__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])},1609,[17,1599]); +__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}},1610,[1597,198]); +__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])},1611,[1597,1610]); +__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}},1612,[1593]); +__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])},1613,[198,1593,1596,1594]); +__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})({})},1614,[]); +__d(function(g,r,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]))},1615,[198,37,1616]); +__d(function(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')},1616,[198]); +__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]}},1617,[17,1592]); +__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]}})})},1618,[1619]); +__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(){}},1619,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1620,[17,24,85,409,777,857,920,899,880,805,804,1561,1563,8]); +__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()})},1621,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1622,[813,779,17,974,385,85,856,899,976,804,777,1352,971,880,1623,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1623,[17,1461,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1624,[]); +__d(function(e,o,s,t,p,n,a){"use strict";p.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf"},1625,[]); +__d(function(o,e,s,t,d,p,c){"use strict";d.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf"},1626,[]); +__d(function(o,e,s,t,d,p,f){"use strict";d.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf"},1627,[]); +__d(function(o,s,e,d,t,p,n){"use strict";t.exports="/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf"},1628,[]); +__d(function(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]})}},1629,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1630,[1631]); +__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},1631,[8,1632,574]); +__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}))}}},1632,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1633,[]); +__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})}}},1634,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/owner-desktop/index.html b/owner-desktop/index.html index a561660556a50890fbcdba8f6ad2cd486d4c6078..137d72cd3966e55117a4df9d70d58799a1ae3ead 100644 --- a/owner-desktop/index.html +++ b/owner-desktop/index.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/owner.html b/owner-desktop/owner.html index cabbc4b115d7e0f7e6e5b266d3b0ee150ea31e64..e69b59301e2fa047505d74d80686f16bef995e58 100644 --- a/owner-desktop/owner.html +++ b/owner-desktop/owner.html @@ -96,5 +96,5 @@ function ccWatch(r){if(r.waiting&&navigator.serviceWorker.controller)ccShowUpdat }, 1000); })(); - + diff --git a/owner-desktop/sw.js b/owner-desktop/sw.js index 0f21b8565af6ad4284b2aa5e15ee3251ec9b48a3..48ad6e1527f78db1b14ebff4ee1d323789b22393 100644 --- a/owner-desktop/sw.js +++ b/owner-desktop/sw.js @@ -1,7 +1,7 @@ // Anchorage owners desktop service worker: precache the app shell so it opens offline after the first visit. -const V = "cc-desk-d7539a6686"; +const V = "cc-desk-1b785ca324"; const BASE = "/owner-desktop/"; -const PRECACHE = ["/owner-desktop/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-desktop/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-desktop/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-desktop/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-desktop/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-desktop/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-desktop/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-desktop/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-desktop/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-desktop/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-desktop/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-desktop/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-desktop/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-desktop/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-desktop/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-desktop/favicon.ico", "/owner-desktop/index.html", "/owner-desktop/_expo/static/js/web/bundle.js?v=d7539a6686eeb34ae7325f22cda3ed1306df23b42423daed5024e2f02dc7a532"]; +const PRECACHE = ["/owner-desktop/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/owner-desktop/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/owner-desktop/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/owner-desktop/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/owner-desktop/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/owner-desktop/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/owner-desktop/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/owner-desktop/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/owner-desktop/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/owner-desktop/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/owner-desktop/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/owner-desktop/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/owner-desktop/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/owner-desktop/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/owner-desktop/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/owner-desktop/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/owner-desktop/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/owner-desktop/favicon.ico", "/owner-desktop/index.html", "/owner-desktop/_expo/static/js/web/bundle.js?v=1b785ca324caa33e44136308372961daf5d587c4bc2458cf83131c39f08022f4"]; // Hugging Face serves large files (fonts) through a redirect to its CDN. Browsers refuse to hand a *redirected* cached // response to a page, so store a plain copy instead (otherwise fonts, and so the app, fail to load offline). const plain = r => r.redirected ? r.blob().then(b => new Response(b, { status: 200, headers: { 'Content-Type': r.headers.get('Content-Type') || b.type || 'application/octet-stream' } })) : Promise.resolve(r); diff --git a/staff-app/_expo/static/js/web/bundle.js b/staff-app/_expo/static/js/web/bundle.js index 587168559b7b18bbfe123ddb7bae87c1d8591fbb..d419555530fa9928e8719e8055d0e344809bd830 100644 --- a/staff-app/_expo/static/js/web/bundle.js +++ b/staff-app/_expo/static/js/web/bundle.js @@ -6,11 +6,11 @@ var __BUNDLE_START_TIME__=globalThis.nativePerformanceNow?nativePerformanceNow() __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,2]); __d(function(g,r,i,a,m,e,d){},1,[]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},2,[3]); -__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1502]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]);var n=r(d[1]);(0,r(d[2]).renderRootComponent)(n.App)},3,[4,7,1503]); __d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},4,[5,6]); __d(function(g,r,i,a,m,e,d){},5,[]); __d(function(g,r,i,a,m,e,d){const _='undefined'==typeof window;globalThis.__webpack_chunk_load__=_=>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)}}},6,[]); -__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])},7,[8,10,17,692,1498,1501]); +__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])},7,[8,10,17,692,1499,1502]); __d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},8,[9]); __d(function(g,r,i,a,m,e,d){ /** @@ -24,7 +24,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},9,[]); __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])},10,[11]); -__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1237,1238,1243,1247,1249,1256,1310,1311,1312,1313,1314,1315,1317,1318,1319,1320,1324,1327,1328,1329,1330,1333,1408,1409,1410,1412,1453,1454,1497]); +__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/manage/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[30],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},11,[12,1023,1237,1238,1243,1247,1249,1256,1310,1311,1312,1313,1314,1315,1317,1318,1319,1320,1324,1327,1328,1329,1330,1333,1409,1410,1411,1413,1454,1455,1498]); __d(function(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]})}},12,[13,17,775,856,909,8]); __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)},13,[14,15,765,766,768]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},14,[]); @@ -921,7 +921,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:20,bookingSlotMinutes:15,deposit:{...r(d[1]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},o={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},u={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},s={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},c=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'9-17 Harbour View, Dunure, KA7 4LN',address:'9-17 Harbour View, Dunure, KA7 4LN',contactEmail:'info@anchoragedunure.com',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:u,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...t,orderAtTable:!1,pay:o,cashUpRecord:[...n.ANCHORAGE_CASH_UP],bookingCoversPerStart:15,bookingPartiesPerStart:4,onlinePartyMin:1,onlinePartyMax:12,bookingNoticeMins:15,autoAcceptUpTo:12},sections:[]}],l=[]},838,[839,841]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return r}}),_e.withTakingsFields=function(e){e=e.filter(e=>!t.includes(e.key));const r=new Set(e.map(e=>e.key)),o=n.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return e;const a=e.findIndex(e=>'cash'===e.key),l=a<0?e.length:a+1;return[...e.slice(0,l),...o,...e.slice(l)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ANCHORAGE_CASH_UP",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"VENUE_CASH_UP_RECORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"cashUpRecordFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"zTotalOf",{enumerable:!0,get:function(){return c}}),_e.tillTakingsOf=d,_e.takingsWorking=function(e){const n=d(e);if(null==n)return null;const t=s(e.card)??0,r=s(e.cash)??0,o=s(e.cardTips),a=t+r===0&&(s(e.gross)??0)>0;return{value:n,from:a?'prepaid':'till',tipsAssumedZero:!a&&null==o,card:t,cash:r,cardTips:o??0}},_e.cashFieldsForRecord=function(e,n){if(!n?.length)return e;const t=new Set,r=[];for(const o of n){const n=f[o],a=n?.key??`cu-${o.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'figure'}`,l=e.find(e=>e.key===a);r.push({...l,...n??{kind:'money'},key:a,label:o}),t.add(a)}return[...r,...e.filter(e=>!t.has(e.key))]},Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return p}}),_e.parseAmount=function(n,t="money"){if('number'===t){const e=n.replace(/[\xa3\s]/g,'');return/^\d{1,6}$/.test(e)?Number(e):null}return(0,e.parseMoneyInput)(n)},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return h}}),_e.weekStartOf=function(e){const n=(k(e).getUTCDay()+6)%7;return h(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return O}}),_e.dailySeries=function(e,n,t,r=T){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,a)=>{const l=h(n,a-t+1),i=o.get(l);return{date:l,value:i?r(i.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),a=r(h(n,-7)),l=null!=o&&null!=a&&0!==a?Math.round((o-a)/a*1e3)/10:null;return{now:o,prev:a,change:l}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),a=o[o.length-1],l=a?h(a.throughDate,1):t,i=e.filter(e=>e.date>=l&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),u=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=l&&e.forDate<=r&&(!a||e.at>a.at)),s=Math.round(100*(i.reduce((e,n)=>e+n.total,0)+u.reduce((e,n)=>e+n.amount,0)))/100;return{from:l,total:Math.max(0,s),days:i,corrections:u,lastPayout:a??null,history:o.slice().reverse()}},_e.shareByHours=function(e,n,t){return e>0&&n>0&&t>0?Math.round(e*(n/t)*100)/100:0},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],a=t.vals??{},l=r.vals??{};for(const e of new Set([...Object.keys(a),...Object.keys(l)]))JSON.stringify(a[e])!==JSON.stringify(l[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o},Object.defineProperty(_e,"dayTakingsOf",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"daysInMonth",{enumerable:!0,get:function(){return C}}),_e.addMonths=P,Object.defineProperty(_e,"monthName",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"shortDay",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return A}}),_e.poundsWhole=function(e){const n=e<0,t=String(Math.round(Math.abs(e))).replace(/\B(?=(\d{3})+(?!\d))/g,',');return`${n?'-':''}\xa3${t}`},_e.monthTakings=function(e,n,t,r){const o=new Map;for(const t of e){if(t.rid!==n)continue;const e=S(t);null!=e&&o.set(t.date,e)}const a=Number(t.slice(0,4)),l=Number(t.slice(5,7)),i=C(a,l),u=Array.from({length:i},(e,n)=>{const a=`${t}-${String(n+1).padStart(2,'0')}`,l=o.get(a),i=null!=l&&a<=r?'recorded':a>r?'future':a===r?'pending':'missing';return{date:a,day:n+1,value:'recorded'===i?l:null,state:i}}),s=u.filter(e=>'recorded'===e.state),c=Math.round(100*s.reduce((e,n)=>e+(n.value??0),0))/100,d=s.reduce((e,n)=>!e||n.value>e.value?{date:n.date,value:n.value}:e,null),f=r.slice(0,7)===t,y=t0?Math.round((c-k)/k*100):null;return{ym:t,month:N(t),days:u,total:c,recorded:s.length,current:f,past:y,best:d,vsPct:T}},Object.defineProperty(_e,"firstTakingsMonth",{enumerable:!0,get:function(){return U}}),_e.canSeeMonthTakings=function(e,n,t={}){return!t.inStaffApp&&'owner'===e&&(n?'owner'===n.role||!0===n.ownerAccess:!t.live)},_e.ownerHomeLayout=function(e,n,t=!1){return!t&&'owner'===e&&(!n||'owner'===n.role||!0===n.ownerAccess)};var e=_r(_d[0]);const n=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],t=['lunchGross','dinnerGross'],r=n.map(e=>e.key);const o=e=>'number'==typeof e.gross?e.gross:null,a=['Z total','Card total','Cash total','Paid out','Card tips','Cash tips'],l={anchorage:a},i=(e,n)=>n?.length?n:l[e],u=e=>Math.round(100*e)/100,s=e=>'number'==typeof e&&Number.isFinite(e)?e:null,c=e=>s(e.zTotal);function d(e){const n=s(e.card),t=s(e.cash),r=s(e.gross),o=null==n&&null==t?null:(n??0)+(t??0);return(null==o||0===o)&&null!=r&&r>0?r:null==o?null:u(o-(s(e.cardTips)??0))}const f={'Z total':{key:'zTotal',kind:'money',optional:!0},'Card total':{key:'card',kind:'money'},'Cash total':{key:'cash',kind:'money'},'Paid out':{key:'paidOut',kind:'money',optional:!0},'Card tips':{key:'cardTips',kind:'money',fixed:!0},'Cash tips':{key:'cashTips',kind:'money',fixed:!0}};const y=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},{key:'paidOut',label:'Paid out',kind:'money',fixed:!0,optional:!0},...n,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],p=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const m=e=>null==e||''===e,b=e=>e.toISOString().slice(0,10),k=e=>new Date(`${e}T12:00:00Z`),h=(e,n)=>{const t=k(e);return t.setUTCDate(t.getUTCDate()+n),b(t)};const T=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},O=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&m(n[e.key])).map(e=>e.key);const S=e=>e.confirmedAt?d(e.vals):null,C=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function P(e,n){const t=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+n;return`${t+Math.floor(r/12)}-${String((r%12+12)%12+1).padStart(2,'0')}`}const D=['January','February','March','April','May','June','July','August','September','October','November','December'],v=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],M=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],N=e=>D[Number(e.slice(5,7))-1]??'',j=e=>{const n=k(e);return`${v[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()].slice(0,3)}`},A=e=>{const n=k(e);return`${M[n.getUTCDay()]} ${n.getUTCDate()} ${D[n.getUTCMonth()]}`};const U=(e,n)=>e.filter(e=>e.rid===n&&null!=S(e)).map(e=>e.date.slice(0,7)).sort()[0]??null},839,[840]); __d(function(g,r,_i,_a,m,e,d){"use strict";function t(t,n){const i=!(!n?.allowMinus||!String(t??'').trim().startsWith('-'));let s=String(t??'').replace(/,/g,'.');s=s.replace(/[^\d.]/g,'');const l=s.indexOf('.');if(l>=0){s=s.slice(0,l+1)+s.slice(l+1).replace(/\./g,'');const[t,n=""]=s.split('.');s=t+'.'+n.slice(0,2)}return(i?'-':'')+s}Object.defineProperty(e,'__esModule',{value:!0}),e.sanitiseMoneyTyping=t,e.parseMoneyInput=function(n){const i=String(n??''),s=i.trim().startsWith('-'),l=i.trim().replace(/^\xa3/,'').replace(/\xa3/g,'').replace(/\s/g,'').replace(/^-/,'');if(l&&/[^\d.,]/.test(l))return null;const c=t(n);if(!c||'.'===c)return null;if(!/^\d+(\.\d{0,2})?$/.test(c))return null;const u=Math.round(100*Number(c))/100;return Number.isFinite(u)?s?-u:u:null},Object.defineProperty(e,"onMoneyChange",{enumerable:!0,get:function(){return n}});const n=n=>i=>n(t(i))},840,[]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,d,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,d,p);if(!l)return[];const c=[t(d,p)?`A deposit of ${s(l)} (${s(e.perPersonPence)} for each of the ${n(d,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${s(l)} (${s(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=d,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=l(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!d(e):'due'===u(e)))},_e.wixPayStatus=l,_e.knownPaid=c,_e.fromWixOrder=f,_e.estimatedWix=b,_e.depositBadge=m,_e.canTickDeposit=function(e){if(d(e))return!1;const t=l(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||l(e)||d(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,d]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${s(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=y,_e.depositShort=function(e){const t=y(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function d(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':d(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function c(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||f(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function f(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function b(e){if(f(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function m(e,t=s){const n=l(e),o=c(e),p=d(e);if(p&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${p.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=b(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const f=u(e);if('none'===f)return null;const m=e.depositLink;return'paid'===m?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===f?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===m?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(m.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===m?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function y(e,t,n=s){const o=m(e,n);if(!o)return null;const u=l(e),c=o.label.startsWith('Deposit paid');if(o.label.startsWith('Deposit waived')){const n=d(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return c?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:c}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:c}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:c}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:c}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:c};const y='PAID'===u?b(e):null,D=y&&y.perHead?`Website bookings shows paid; amount worked out at ${n(y.perHead)} a head`:f(e)&&c?'Amount from the website bookings order':void 0,P=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(D?`. ${D}`:'');return{label:o.label,kind:o.kind,a11y:P,note:D,paid:c}}},841,[]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.childrenIn=t,Object.defineProperty(_e,"adultsIn",{enumerable:!0,get:function(){return n}}),_e.depositDue=o,_e.depositWords=function(e,s,u,p=0){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const l=o(e,s,p);if(!l)return[];const c=[t(s,p)?`A deposit of ${d(l)} (${d(e.perPersonPence)} for each of the ${n(s,p)} adults; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`:`A deposit of ${d(l)} (${d(e.perPersonPence)} per adult; children don't count towards the ${e.fromParty} and don't pay) is needed for ${e.fromParty} or more adults.`];!0===e.refundable?c.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?c.push('The deposit is not refundable.'):c.push(`Ask ${u} about refunds.`);e.policy.trim()&&c.push(e.policy.trim());return c.push(e.wixLinksOn?`${u} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${u} will tell you how to pay the deposit.`),c},_e.waiverOf=s,_e.depositState=u,_e.waiverText=p,_e.canWaiveDeposit=function(e){if(['cancelled','finished','noshow','declined'].includes(e.status??''))return!1;const t=b(e);return'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&'FREE'!==t&&('paid'!==e.depositLink?.state&&('NOT_PAID'===t||'PARTIALLY_PAID'===t?!s(e):'due'===u(e)))},_e.depositAddedToTable=l,Object.defineProperty(_e,"DEPOSIT_ADDED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"isPaidLabel",{enumerable:!0,get:function(){return f}}),_e.wixPayStatus=b,_e.knownPaid=m,_e.fromWixOrder=D,_e.estimatedWix=y,_e.depositBadge=P,_e.canTickDeposit=function(e){if(s(e))return!1;const t=b(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===u(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||b(e)||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===u(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[n,o,s]=e.date.split('-').map(Number),u=new Date(n,(o||1)-1,s||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),p=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${u} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${d(e.amountPence)} deposit here: ${e.url}`];p&&l.push(`The link works until ${p}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=k,_e.depositTick=function(e){const t=w(e);return'Deposit paid'===t||t===c},_e.depositShort=w;const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){const n=Math.max(0,Math.round(Number(e)||0)),o=Math.round(Number(t)||0);return Math.max(0,Math.min(n,o))}const n=(e,n)=>Math.max(0,Math.round(Number(e)||0)-t(e,n));function o(e,t,o=0){return!e.on||e.perPersonPence<=0||n(t,o)`\xa3${(e/100).toFixed(e%100?2:0)}`;function s(e){const t=e.depositWaived;return t&&'object'==typeof t&&'string'==typeof t.by&&t.by?t:null}function u(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':s(e)?'waived':'due':'none'}function p(e){const t=new Date(e.at),n=!Number.isNaN(t.getTime())?t.toLocaleString('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).replace(',',''):'';return`Waived by ${e.by}${n?`, ${n}`:''}${e.note?.trim()?` (${e.note.trim()})`:''}`}function l(e){return'added_to_table'===e.depositStatus}const c='Deposit added to bill',f=e=>e.startsWith('Deposit paid')||e.startsWith(c);function b(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function m(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||D(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function D(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function y(e){if(D(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function P(e,t=d){const n=h(e,t);if(n&&n.label.startsWith('Deposit paid')&&l(e)){const o=m(e);return{label:o?`${c} \xb7 ${t(o)}`:c,kind:n.kind}}return n}function h(e,t){const n=b(e),o=m(e),d=s(e);if(d&&'PAID'!==n&&(!e.depositPaidBy||!o)&&'paid'!==e.depositLink?.state&&'paid'!==u(e))return{label:`Deposit waived \xb7 ${d.by}`,kind:'neutral'};if(n&&'FREE'!==n){if(e.depositPaidBy&&o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};if('PAID'===n){if(o)return{label:`Deposit paid \xb7 ${t(o)}`,kind:'gold'};const n=y(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===n?{label:o&&(e.depositDue??0)>o?`Part paid on website bookings \xb7 ${t(o)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===n?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===n?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const p=u(e);if('none'===p)return null;const l=e.depositLink;return'paid'===l?.state?{label:o?`Deposit paid on website bookings \xb7 ${t(o)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===p?{label:o?`Deposit paid \xb7 ${t(o)}`:'Deposit paid',kind:'gold'}:'open'===l?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(l.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===l?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function k(e,t,n=d){const o=P(e,n);if(!o)return null;const u=b(e),l=f(o.label),m=o.label.startsWith(c);if(o.label.startsWith('Deposit waived')){const n=s(e);return{label:t?o.label:'Deposit waived',kind:'neutral',a11y:p(n).replace(/^Waived/,'Deposit waived'),note:t?p(n):void 0,paid:!1}}if(!t)return m?{label:`\u2713 ${c}`,kind:'gold',a11y:c,paid:l}:l?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:l}:'PARTIALLY_PAID'===u?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:l}:'FULLY_REFUNDED'===u||'PARTIALLY_REFUNDED'===u?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:l}:'NOT_PAID'===u?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:l}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:l};const h='PAID'!==u||m?null:y(e),k=h&&h.perHead?`Website bookings shows paid; amount worked out at ${n(h.perHead)} a head`:D(e)&&l?'Amount from the website bookings order':void 0,w=o.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(k?`. ${k}`:'');return{label:o.label,kind:o.kind,a11y:w,note:k,paid:l}}function w(e){const t=k(e,!1);return t?t.a11y.split(',')[0]:null}},841,[]); __d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},842,[843,844]); __d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'},e.withTableWord=function(t){const n=t.trim();return!n||/^tables?\b/i.test(n)||/^no table\b/i.test(n)?n:`Table ${n}`};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},843,[]); __d(function(e,a,l,r,t,o,s){t.exports={venue:"The Anchorage",note:"From Gordon 28 Oct 2026; layout from Gordon's floor-plan photo 29 Oct 2026 (positions, sizes, shapes, labels scaled from the photo, one scale for all areas). Photo shows MT12 and no MT8: table 8 replaced by 12. Gordon confirmed 29 Oct: no table 8; MT11 and MT12 both exist, MT11 keeps 2 seats, MT12 = 2 seats. No tables 4 or 8. No joined tables: Gordon confirmed 29 Oct that DT1 and DT2 are not joined.",areas:[{name:"Public Bar",label:"Dog friendly area (Public Bar), Area 1",colour:"#CFA45F",server:"BR",dogFriendly:!0,tables:[[1,4],[2,4],[3,5],[5,2],[6,4]],layout:{1:{label:"DT1",shape:"rect",x:600,y:125,w:205,h:90},2:{label:"DT2",shape:"rect",x:395,y:130,w:100,h:190},3:{label:"DT3",shape:"rect",x:205,y:120,w:110,h:245},5:{label:"DT5",shape:"square",x:500,y:395,w:105,h:105},6:{label:"DT6",shape:"rect",x:195,y:395,w:205,h:110}},best:[1,3]},{name:"Main Restaurant",label:"Main restaurant (no pets)",colour:"#8EC5FF",server:"SV",dogFriendly:!1,tables:[[7,5],[9,7],[10,4],[11,2],[12,2],[13,4],[14,4],[15,4],[16,2]],layout:{7:{label:"MT7",shape:"rect",x:590,y:410,w:225,h:115},9:{label:"MT9",shape:"rect",x:560,y:105,w:260,h:110},10:{label:"MT10",shape:"square",x:430,y:400,w:130,h:130},11:{label:"MT11",shape:"rect",x:545,y:270,w:115,h:90},12:{label:"MT12",shape:"rect",x:400,y:270,w:120,h:95},13:{label:"MT13",shape:"rect",x:400,y:100,w:90,h:115},14:{label:"MT14",shape:"rect",x:185,y:420,w:230,h:100},15:{label:"MT15",shape:"rect",x:190,y:220,w:165,h:145},16:{label:"MT16",shape:"rect",x:185,y:105,w:125,h:80}},best:[7,9]},{name:"Sitooterie",label:"Sitooterie (fully covered conservatory, no pets)",colour:"#C79BE8",server:"DM",dogFriendly:!1,tables:[[17,2],[18,6],[19,4],[20,6],[21,4],[22,4],[23,4]],layout:{17:{label:"ST17",shape:"square",x:760,y:325,w:110,h:110},18:{label:"ST18",shape:"rect",x:605,y:135,w:270,h:115},19:{label:"ST19",shape:"rect",x:460,y:160,w:105,h:150},20:{label:"ST20",shape:"rect",x:135,y:125,w:265,h:120},21:{label:"ST21",shape:"rect",x:120,y:305,w:110,h:175},22:{label:"ST22",shape:"rect",x:255,y:310,w:115,h:175},23:{label:"ST23",shape:"rect",x:410,y:350,w:110,h:155}},best:[19,21]},{name:"Beer Garden",label:"Outdoor beer garden (weather permitting, no shelter, pets allowed)",colour:"#B08D57",server:"GD",dogFriendly:!0,outdoor:!0,weatherDependent:!0,tables:[[24,4],[25,4],[26,4],[27,6],[28,6],[29,4],[30,4],[31,4]],layout:{24:{label:"BGT24",shape:"round",x:740,y:70,w:130,h:130},25:{label:"BGT25",shape:"round",x:515,y:50,w:135,h:135},26:{label:"BGT26",shape:"round",x:310,y:50,w:135,h:135},27:{label:"BGT27",shape:"rect",x:560,y:235,w:280,h:115},28:{label:"BGT28",shape:"rect",x:245,y:235,w:270,h:110},29:{label:"BGT29",shape:"rect",x:210,y:365,w:190,h:60},30:{label:"BGT30",shape:"rect",x:180,y:445,w:190,h:55},31:{label:"BGT31",shape:"rect",x:130,y:520,w:215,h:60}},best:[27,28]}],photoScale:1.8,joins:[],bestNote:"Best tables per area from Gordon, 1 Nov 2026: Bar 1 and 3; Restaurant 7 and 9; Sitooterie 19 and 21; Outside (Beer Garden) 27 and 28. Shown as BEST for walk-ins and bookings when they fit; editable per area in the table plan."}},844,[]); @@ -979,7 +979,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},896,[820]); __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},897,[896]); __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.'}},898,[856,17,85,899,880,804,777,8]); -__d(function(e,t,a,s,n,r,i){"use strict";Object.defineProperty(r,'__esModule',{value:!0}),Object.defineProperty(r,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(r,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(r,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(r,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(r,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(r,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(r,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(r,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(r,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(r,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(r,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(r,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(r,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),r.rotaReconcile=Tt,r.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},r.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setTempOwnerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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.'}}},r.setManagerAccess=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 r=String(s??'');return ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(r)}:t)})),{ok:!0,role:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:r}=await Te().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(r)return{ok:!1,message:r.message};const i=String(n);return'cashup'===e?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})):pe.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:i}:e)})),{ok:!0,until:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.readCashAudit=async function(e){if(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},r.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},r.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},r.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},r.readPushLive=ha,r.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},r.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(r,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),r.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:r}=await Te().storage.from(Sa).upload(n,s,{upsert:!0,contentType:'image/jpeg'});return r?{ok:!1,message:r.message}:{ok:!0,path:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.orderLogoUrl=async function(e){const t=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},r.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(r,"usePushLive",{enumerable:!0,get:function(){return va}}),r.claimInvite=Ka,r.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},r.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},r.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},r.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const r=n?.error;return'not_display'===r||'not_kitchen'===r||'not_kitchen_role'===r||'missing'===r?{ok:!1,error:r}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},r.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},r.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},r.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},r.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},r.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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'}}},r.claimInviteForSync=async function(e){const t=await Ka(e);return'ok'===t.status?t.id:null},r.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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,r=String(n.app??'staff');return{ok:!0,token:String(n.token),expiresAt:String(n.expiresAt),app:'owner'===r||'chef'===r?r:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},r.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},r.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},r.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},r.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},r.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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{}}},r.resetStaffLinkPhone=async function(e){if(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},r.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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},r.pairWithCode=async function(e){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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}`}}},r.carPairStart=async function(){if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},r.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],r=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==r&&'unknown'!==r||await qa(),r}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},r.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},r.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},r.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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}))},r.carRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},r.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},r.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},r.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},r.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},r.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},r.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},r.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},r.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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.'})},r.wipeThisDevice=async function(e={}){try{await Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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},r.guestSession=La,Object.defineProperty(r,"rpc",{enumerable:!0,get:function(){return Ba}}),r.mendSession=Wa,r.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,re.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(r,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),r.serverOrder=ss,Object.defineProperty(r,"guestWords",{enumerable:!0,get:function(){return ns}}),r.nudgeGuestSync=function(){rs?.()},Object.defineProperty(r,"syncInternals",{enumerable:!0,get:function(){return is}}),r.stockSaveBlocker=os,r.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},r.resendUnsavedStockEvents=ds,r.saveStockEventsNow=us,r.bookingSaveBlocker=ls,r.resendUnsavedBookings=gs,r.saveBookingsNow=ms,r.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const r=[],i=e=>{s||(s=!0,r.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return i({state:'refused',why:t.why});n()||i((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};r.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),r.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>i(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},r.tempSaveBlocker=ws,r.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),r=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>r.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},r.saveTempNow=ks,r.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',r=vs().find(t=>t.spec.table===e),i=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!r?.unsavedKeys().includes(t))?Date.now()-i>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},r.goLive=Os,Object.defineProperty(r,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),r.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_date:t}).then(s=>{const n=[],r=[];(s??[]).forEach((a,s)=>{'booking'===a.kind?n.push({id:`pub-${t}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:t,time:He(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:''}):r.push({id:`pubblk-${t}-${s}`,rid:e,date:t,from:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:r},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},r.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const r=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...r,id:e})},r.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},r.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},r.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};var o=t(i[0]),d=t(i[1]),u=t(i[2]),c=t(i[3]),l=t(i[4]),f=t(i[5]),p=t(i[6]),g=t(i[7]),m=t(i[8]),_=t(i[9]),y=t(i[10]),h=t(i[11]),S=t(i[12]),w=t(i[13]),v=t(i[14]),k=t(i[15]),b=t(i[16]),I=t(i[17]),R=t(i[18]),O=t(i[19]),A=t(i[20]),C=t(i[21]),D=t(i[22]),U=t(i[23]),T=t(i[24]),E=t(i[25]),N=t(i[26]),P=t(i[27]),K=t(i[28]),M=t(i[29]),x=t(i[30]),q=t(i[31]),j=t(i[32]),L=t(i[33]),B=t(i[34]),$=t(i[35]),F=t(i[36]),H=t(i[37]),W=t(i[38]),Q=t(i[39]),V=t(i[40]),G=t(i[41]),J=t(i[42]),Z=t(i[43]),z=t(i[44]),Y=t(i[45]),X=t(i[46]),ee=t(i[47]),te=t(i[48]),ae=t(i[49]),se=t(i[50]),ne=t(i[51]),re=t(i[52]),ie=t(i[53]),oe=t(i[54]),de=t(i[55]),ue=t(i[56]),ce=t(i[57]),le=t(i[58]),fe=t(i[59]),pe=t(i[60]),ge=t(i[61]),me=t(i[62]),_e=t(i[63]),ye=t(i[64]),he=t(i[65]),Se=(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})(he),we=t(i[66]),ve=t(i[67]),ke=t(i[68]),be=t(i[69]),Ie=t(i[70]),Re=t(i[71]),Oe=t(i[72]),Ae=t(i[73]),Ce=t(i[74]),De=t(i[75]),Ue=t(i[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};const n=e,r='Wix'===n.importedFrom||Array.isArray(e.tags)&&e.tags.includes('Wix'),i=n.externalSource??(r?'Wix':null),o=n.externalId??(r?e.id:null);return{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...i?{external_source:i}:{},...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;return'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim()),s},apply:(e,t)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.bookings.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{bookings:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.useStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.orders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{orders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.blockClock)(t.to_time)??a?.to,r='string'==typeof t.block_date?t.block_date.slice(0,10):a?.date;return s&&n&&r?{...a??{by:t.created_by??'',createdAt:t.created_at},id:String(t.id),rid:e,date:r,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)=>te.useBlocks.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>!i.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.useShellStore.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.key,e])),i=(s.items[e]??[]).filter(e=>!n.has(e.key)).map(e=>r.get(e.key)??e),o=new Set(i.map(e=>e.key));return{items:{...s.items,[e]:[...i,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function rt(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.useShellStore.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.events.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{events:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function it(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:r,extra:i}=(0,Ce.cardToRow)(s,a);return{...r,...i,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),n=new Set(e.map(e=>e.card.menuItemId)),r=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),i=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(i.map(e=>e.id));return r.length&&z.useStore.setState(e=>({menu:e.menu.map(e=>r.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...i,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...r]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>re.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>re.useOrderSheets.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=(s.sheets[e]??[]).filter(e=>!n.has(e.id)).map(e=>r.get(e.id)??e),o=new Set(i.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...i,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>re.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,n,r]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,n-1,r).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.shifts.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{shifts:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.attendance.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{attendance:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{timeRequests:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.useOwner.setState(s=>{const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e(),o=s.chat.filter(e=>!n.has(e.id)).map(e=>r.has(e.id)?{...e,...r.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=i&&s.chatRead?.[i]||{},c=t.filter(e=>!d.has(e.id)).map(e=>{return{...e,reactions:{},seenBy:e.from===i?[e.from]:i&&Date.parse(e.at)<=(t=e.ch,Math.max(Date.parse(u['*']??'')||0,Date.parse(u[t]??'')||0))?[i]:[]};var t});return{chat:c.length?[...o,...c].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',r=Wt(String(t.channel)),i=e();if(!r||!i||n===i||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[i]??[]).includes(r))return;if(!(0,be.inChannel)(r,o.staff.find(e=>e.id===i)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=r.startsWith('dm:')?'sent you a message':`in ${'all'===r?'Everyone':'foh'===r?'Front of house':'kitchen'===r?'Kitchen':'managers'===r?'Managers':r}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),r='*'===t?'*':Ht(t);if(n&&r)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:r,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().from('chat_reads').select('channel,read_at').eq('venue_id',e).eq('staff_id',a);if(n||!s?.length)return;const r={};for(const e of s){const t='*'===e.channel?'*':Wt(String(e.channel));t&&(r[t]=new Date(e.read_at).toISOString())}Object.keys(r).length&&ce.useOwner.getState().chatMarkRead(t,r)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.useReminders.setState(s=>{const n=new Set(a),r={...s.rules},i=t.filter(e=>'break_rules'===e.kind);for(const t of i)r[e]={...(0,E.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};r[e]&&n.has(r[e].id)&&delete r[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:r,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.useReminders.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.done.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{done:[...e.filter(e=>!i.has(e.id)),...r].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(e,t,a,s=()=>!0){const n=new Set(a),r=new Map(t.map(e=>[e.id,e])),i=e.filter(e=>!s(e)||!n.has(e.id)).map(e=>s(e)&&r.has(e.id)?r.get(e.id):e),o=new Set(i.map(e=>e.id));return[...i,...t.filter(e=>!o.has(e.id))]}const Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ra(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ia(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const r=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:n,lists:Yt(s.lists,r,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({items:s.items,updatedAt:s.updatedAt})});for(const[s,n]of Object.entries(t.people)){const[t,r]=s.split('|');t===e&&n.updatedAt&&a.push({id:(0,we.personRowId)(e,r),kind:'person',staffRef:r,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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),r=new Set(n.map(e=>e.id));return{questions:[...n,...e.filter(e=>!r.has(e.id))]}})},subscribe:e=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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,r)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:n,p_kind:r}),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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(t){if(!(0,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}r=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!r.includes('device.write')&&(r=[...r,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const r=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),rt(a),it(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.suppliers.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{suppliers:[...r,...e.filter(e=>!i.has(e.id))]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&r.push(Ps(a)),n&&(r.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(r.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.useOwner.setState(a=>{const s=new Set(t),n=new Map(e.map(e=>[e.id,e])),r=a.leave.filter(e=>!s.has(e.id)).map(e=>n.get(e.id)??e),i=new Set(r.map(e=>e.id));return{leave:[...e.filter(e=>!i.has(e.id)),...r]}}),subscribe:e=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&r.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(r.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(r.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(r.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(r.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(r.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(r.push(Zt(a)),n&&r.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(r.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(r.push(da(a)),ha()),t&&r.push(ua(a),ca(a),la(a)),s&&r.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){r.push(ra(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&r.push(ia(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),r.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(r.push(sa(a)),Ga.add('sales_reports')),t(i[78])(i[77],i.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(r.push(Et(),Nt()),await ya('scheduled_notifications')&&r.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(r.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(r.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(r.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(r.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(r.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=r.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===r[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),r=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||r.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of r)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),rs=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let rs=null;const is={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),r={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},i=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));i(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),i(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),i(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),i(ue.useSafety.getState(),r)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(r));const o=(0,U.stripHrSamples)(U.useHr.getState());i(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());i(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=re.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};i(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),re.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return i(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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 r=[...n.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));oe.useSetup.getState().patch(e,{grades:r})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=ie.useAvatars.getState().photos[e];if(!t){a?.path&&ie.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const r=await qs(s);r.startsWith('data:image/')&&ie.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:r,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=ie.useAvatars.getState().photos[t];try{const n=Ms.get(t),r=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!ie.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),r(n)),void(e&&ie.useAvatars.getState().doneClear(t))}if(s.path)return;const i=await(await fetch(s.dataUrl)).blob();if(i.size>512e3)return void Ne({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===i.type?'jpg':'image/webp'===i.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await Te().storage.from(Ks).upload(d,i,{upsert:!1,contentType:i.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&r(n),ie.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:ie.useAvatars.getState().photos},s=ie.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),ie.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); +__d(function(e,t,a,s,n,i,r){"use strict";Object.defineProperty(i,'__esModule',{value:!0}),Object.defineProperty(i,"pointFromRow",{enumerable:!0,get:function(){return V.pointFromRow}}),Object.defineProperty(i,"pointToRow",{enumerable:!0,get:function(){return V.pointToRow}}),Object.defineProperty(i,"readingFromRow",{enumerable:!0,get:function(){return V.readingFromRow}}),Object.defineProperty(i,"readingToRow",{enumerable:!0,get:function(){return V.readingToRow}}),Object.defineProperty(i,"sameReading",{enumerable:!0,get:function(){return V.sameReading}}),Object.defineProperty(i,"inviteRefusal",{enumerable:!0,get:function(){return O.inviteRefusal}}),Object.defineProperty(i,"keysToWipe",{enumerable:!0,get:function(){return O.keysToWipe}}),Object.defineProperty(i,"changedFields",{enumerable:!0,get:function(){return A.changedFields}}),Object.defineProperty(i,"useSync",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(i,"can",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(i,"isLive",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(i,"stockEventSaved",{enumerable:!0,get:function(){return at}}),Object.defineProperty(i,"ROTA_READ_CAP",{enumerable:!0,get:function(){return Ut}}),i.rotaReconcile=Tt,i.markChatRead=function(e,t){if(!e)return;const a=(new Date).toISOString();ce.useOwner.getState().chatMarkRead(e,{[t]:a});const s=ce.useOwner.getState();new Set(s.chat.filter(a=>('*'===t||a.ch===t)&&!a.seenBy.includes(e)).map(e=>e.ch)).forEach(t=>ce.useOwner.getState().chatSeen(t,e)),Gt(e,t,a)},i.setTempManagerAccess=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:n}=await Te().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.'}:(ce.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=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:n}=await Te().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 ce.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...bt(i)}:t)})),{ok:!0,role:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},i.unlockCashUp=async function(e,t,a){if(ye.PITCH)return Se.unlockCashUp(e,t,a);const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:n,error:i}=await Te().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?pe.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):pe.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(ye.PITCH)return Se.cashAudit(e);const t=Ee.getState().venueId;if(!t)return[];let a=Te().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,A.changedFields)(e.old_row,e.new_row)}))},i.readClockChanges=async function(e=30){if(ye.PITCH)return null;const t=Ee.getState().venueId;if(!t)return null;try{const{data:a,error:s}=await Te().rpc('owner_clock_changes',{p_venue:t,p_days:e});return s||!Array.isArray(a)?null:a}catch{return null}},i.readLoyaltyInsight=async function(){if(ye.PITCH)return null;const e=Ee.getState().venueId;if(!e)return null;try{const t=await Te().rpc('owner_loyalty_insight',{p_venue:e});if(!t.error&&t.data&&'object'==typeof t.data)return{raw:t.data,source:'server'};const a=await Te().rpc('loyalty_summary',{p_venue:e});return!a.error&&a.data&&'object'==typeof a.data?{raw:a.data,source:'summary'}:null}catch{return null}},i.setPushLive=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await Te().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(va.setState({live:!!a,known:!0}),{ok:!0})},i.readPushLive=ha,i.readAccessLog=async function(){const e=Ee.getState().venueId;if(!e)return[];try{const{data:t}=await Te().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},i.readSyncHeartbeats=async function(){const e=Ee.getState().venueId;if(!e)return[];const{data:t,error:a}=await Te().from('device_sync_heartbeats').select('device_id,app,who,version,last_synced_at,realtime,pending,failed,user_agent,seen_at').eq('venue_id',e).order('seen_at',{ascending:!1}).limit(50);if(a)throw a;return t??[]},Object.defineProperty(i,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return Sa}}),i.uploadOrderLogo=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),n=`${a}/${e}-${Date.now()}.jpg`,{error:i}=await Te().storage.from(Sa).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=wa.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await Te().storage.from(Sa).createSignedUrl(e,3600);if(t?.signedUrl)return wa.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},i.removeOrderLogo=async function(e){try{await Te().storage.from(Sa).remove([e])}catch{}},Object.defineProperty(i,"usePushLive",{enumerable:!0,get:function(){return va}}),i.claimInvite=Ka,i.makeChromeHandover=async function(){const e=Ee.getState();if(ye.PITCH)return{ok:!0,code:'pitch-handover-code-aaaaaaaaaaaa'};if('staff'!==e.kind||!e.venueId)return{ok:!1,message:'Sign in from your personal link first.'};try{const{data:t,error:a}=await Te().rpc('make_chrome_handover',{p_venue:e.venueId,p_app:Me});return a||'string'!=typeof t?{ok:!1,message:a?.message?.replace(/^.*?:\s*/,'')||'Could not open Chrome. Check your connection and try again.'}:{ok:!0,code:t}}catch{return{ok:!1,message:'Could not open Chrome. Check your connection and try again.'}}},i.claimChromeHandover=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_chrome_handover',{p_code:e,p_app:Me});if(a){if(/expired|no longer active/i.test(a.message))return{status:'refused',message:a.message.replace(/^.*?:\s*/,'')};throw a}const s=t?.[0];if(!s)return{status:'refused',message:'This Chrome link has expired. Open CoverCharge on your phone and tap Open in Chrome again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.displayKitchenUnlock=async function(e){if(ye.PITCH)return{ok:!1,error:'not_set'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:t,error:a}=await Te().rpc('display_kitchen_unlock',{p_code:e});if(a)return{ok:!1,error:'offline'};const s=t;if(s&&s.ok&&'string'==typeof s.ticket)return{ok:!0,ticket:s.ticket};const n=s?.error;return'wrong'===n||'locked'===n||'not_display'===n||'not_set'===n?{ok:!1,error:n}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.claimDisplayKitchen=async function(e){if(ye.PITCH||!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Te().rpc('claim_display_kitchen',{p_ticket:e});if(a){const e=a.message.replace(/^.*?:\s*/,'');return/expired|already signed in|no longer active|belongs to the Display/i.test(a.message)?{status:'refused',message:e}:{status:'refused',message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'}}const s=t?.[0];if(!s)return{status:'refused',message:'That unlock has expired. Go back to the Display and enter the code again.'};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 L.kv.set(Da,n),Be&&Ha(),{status:'ok',id:n}}catch(e){return{status:'offline',message:String(e?.message??e)}}},i.endDisplayKitchen=async function(){try{qe(),await Te().rpc('end_display_kitchen')}catch{}try{await L.kv.remove(Da)}catch{}},i.displayAssignKitchenRole=async function(e,t){if(ye.PITCH)return{ok:!1,error:'not_display'};if(!(0,K.isSupabaseConfigured)())return{ok:!1,error:'offline'};try{qe();const{data:a,error:s}=await Te().rpc('display_assign_kitchen_role',{p_shift:e,p_badge:t??null});if(s)return{ok:!1,error:'offline'};const n=a;if(n&&n.ok)return{ok:!0,badge:n.badge??void 0};const i=n?.error;return'not_display'===i||'not_kitchen'===i||'not_kitchen_role'===i||'missing'===i?{ok:!1,error:i}:{ok:!1,error:'offline'}}catch{return{ok:!1,error:'offline'}}},i.signedInHereAs=async function(e){qe();const t=await L.kv.get(Da,null);return!!t&&'staff'===t.kind&&t.staffRef===e},i.rememberedInviteHere=async function(e){return qe(),await L.kv.get(Ua,null)===e},i.kirkmichaelStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_KIRKMICHAEL||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.wildingsStaffAppUrl=async function(){const e=Ee.getState();if(!ee.IS_WILDINGS||'staff'!==e.kind||e.venueId!==ee.VENUE_UUID||e.staffRef!==D.useSession.getState().meId)return null;qe();const t=await L.kv.get(Ua,null);return t?(0,D.appUrl)('staff',t):null},i.forgetSignInHere=async function(){qe(),await L.kv.remove(Da),await L.kv.remove(Ua),Ne({mode:'signin',perms:[]});try{await Fa()}catch{}},i.approveShiftSwap=async function(e,t,a){const s=Ee.getState().venueId;if(ye.PITCH||!s||'staff'!==Ee.getState().kind)return{ok:!0};if(!(0,le.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Ba('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 Ka(e);return'ok'===t.status?t.id:null},i.reissueInvite=async function(e){if(ye.PITCH)return Se.reissueInvite(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await Te().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.currentStaffAppLinks=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('current_staff_app_links',{p_venue:t,p_staff_ref:e})},i.makeStaffAppLink=async function(e,t){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Ba('make_staff_app_link',{p_venue:a,p_staff_ref:e,p_platform:t})},i.staffAppLinkHistory=async function(e){return Ba('staff_app_link_history',{p_venue:Ee.getState().venueId,p_staff_ref:e})},i.revokeStaffAppLink=async function(e){await Ba('revoke_staff_app_link',{p_venue:Ee.getState().venueId,p_link_id:e})},i.staffLinkPhones=async function(){if(ye.PITCH)return Se.linkPhones();const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return{};try{const t=await Ba('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(ye.PITCH)return Se.resetPhone(e);const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');return Number(await Ba('reset_staff_link_phone',{p_venue:t,p_staff_ref:e}))},i.readInviteStatus=async function(){if(ye.PITCH)return Se.inviteStatus();const e=Ee.getState().venueId;if(!e)return{};const{data:t,error:a}=await Te().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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:t,error:a}=await Te().rpc((0,p.claimPairingRpc)(),{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 L.kv.set(Ca,n),Ha(),{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,K.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await Pa();const{data:e,error:t}=await Te().rpc('car_pair_start',{p_venue_slug:'anchorage'});if(t)throw t;const a=e?.[0];return a?(await L.kv.set(Ma,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:xa(e)}}},i.carPairPoll=async function(e){try{qe();const t=e??await L.kv.get(Ma,null);if(!t)return'unknown';const{data:a,error:s}=await Te().rpc('car_pair_poll',{p_request:t});if(s)throw s;const n=a?.[0],i=String(n?.status??'unknown');if((0,X.carPairApproved)(n)){const e=(0,X.carDeviceIdentity)({venue_id:n.venue_id,venue_slug:n.venue_slug,venue_name:n.venue_name,role_key:n.role_key,label:n.label}),t=await L.kv.get(Ca,null);await L.kv.set(Ca,e),await L.kv.remove(Da),D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({staffAs:void 0,previewRole:'owner'}),t&&t.venueId===e.venueId&&'device'===t.kind||Ha()}return'revoked'!==i&&'unknown'!==i||await qa(),i}catch(e){return/fetch|network/i.test(String(e?.message??e))?'offline':'unknown'}},i.carSignOut=async function(){try{qe(),await Te().rpc('car_sign_out')}catch{}await qa(),await Fa();try{await Te().auth.signOut({scope:'local'})}catch{}Ne({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This car is unpaired.'})},i.carApprove=async function(e,t="Tesla"){const a=Ee.getState().venueId;if(!a||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const s=(await Ba('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:xa(e)}}},i.carList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('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=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('car_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:xa(e)}}},i.assistantApprove=async function(e){const t=Ee.getState().venueId;if(!t||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const a=(await Ba('assistant_pair_approve',{p_venue:t,p_code:e}))?.[0];return a?.id?{ok:!0}:{ok:!1,message:String(a?.message??'That code isn\u2019t right or has run out.')}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_devices_list',{p_venue:e})??[]).map(e=>({id:e.id,label:e.label,approvedAt:e.approved_at,lastSeenAt:e.last_seen_at??void 0,enabled:!1!==e.enabled,ownerName:e.owner_name?String(e.owner_name):void 0}))},i.assistantSetEnabled=async function(e,t){const a=Ee.getState().venueId;if(!a)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_set_enabled',{p_venue:a,p_id:e,p_enabled:t}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantAccess=async function(){const e=Ee.getState().venueId;if(!e)return{plan:null,allowed:!1};const t=(await Ba('assistant_access',{p_venue:e}))?.[0];return{plan:null!=t?.plan?String(t.plan):null,allowed:!0===t?.allowed,reason:t?.reason?String(t.reason):void 0}},i.assistantAuditList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_audit_list',{p_venue:e,p_limit:100})??[]).map(e=>({id:String(e.id),at:String(e.at),actor:String(e.actor??''),actorName:e.actor_name?String(e.actor_name):void 0,action:String(e.action??''),detail:e.detail?String(e.detail):void 0}))},i.assistantRevoke=async function(e){const t=Ee.getState().venueId;if(!t)return{ok:!1,message:'Not connected.'};try{return await Ba('assistant_revoke',{p_venue:t,p_id:e}),{ok:!0}}catch(e){return{ok:!1,message:ja(e)}}},i.assistantProposalsList=async function(){const e=Ee.getState().venueId;if(!e)return[];return(await Ba('assistant_proposals_list',{p_venue:e})??[]).map(e=>({id:String(e.id),kind:String(e.kind??''),summary:String(e.summary??''),warning:e.warning?String(e.warning):void 0,status:String(e.status??''),needsDoubleConfirm:!0===e.needs_double_confirm,canDecide:!0===e.can_decide,expiresAt:e.expires_at?String(e.expires_at):void 0,createdAt:e.created_at?String(e.created_at):void 0,decidedByName:e.decided_by_name?String(e.decided_by_name):void 0,appliedStamp:e.applied_stamp?String(e.applied_stamp):void 0,error:e.error?String(e.error):void 0}))},i.assistantProposalDecide=async function(e,t,a=!1){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)return{ok:!1,message:'Your phone needs to be connected first. Check your signal and try again.'};try{const n=(await Ba('assistant_proposal_decide',{p_venue:s,p_id:e,p_decision:t,p_double_confirm:a}))?.[0];return n?.id?{ok:!0}:{ok:!1,message:String(n?.error??n?.message??'That change could not be confirmed.')}}catch(e){return{ok:!1,message:ja(e)}}},i.unpairDisplay=async function(){await L.kv.remove(Ca),await Fa();try{await Te().auth.signOut()}catch{}Ne({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},i.disconnectStaff=async function(){await L.kv.remove(Da),await L.kv.remove(Ua),await Fa();try{await Te().auth.signOut()}catch{}Ne({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 Fa()}catch{}try{(0,K.isSupabaseConfigured)()&&await Te().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:${ee.VENUE_RID}:`)):(0,O.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())!ee.IS_ISOLATED_VENUE&&/data|api|photo/i.test(t)&&await e.delete(t)}catch{}Ne({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=La,Object.defineProperty(i,"rpc",{enumerable:!0,get:function(){return Ba}}),i.mendSession=Wa,i.startAppSync=async function(e=ee.VENUE_RID){if(ee.IS_ISOLATED_VENUE&&e!==ee.VENUE_RID)return;if(Be)return;Be=!0,Qa=e,'customer'===Me&&'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(qe(),'customer'!==Me){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'===Me&&(0,w.isAnchorage)(e)?[z.useStore,ce.useOwner,de.useKitchen,ue.useSafety,ne.useCardStore,y.useGpCalc,ie.useOrderSheets,S.useSpecials,U.useHr]:[z.useStore,ce.useOwner,de.useKitchen];if(await Promise.all(a.map(t)),'chef'===Me&&(0,w.isAnchorage)(e)&&a.some(e=>!e.persist.hasHydrated()))return void Ne({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 Ts(e)}catch{if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e))return void Ne({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,K.isSupabaseConfigured)())return void Ne({mode:'off'});H.mutationQueue.subscribe(()=>{const e=H.mutationQueue.waiting,t=e[0];Ne({pending:H.mutationQueue.pending.length,failed:H.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,$.describeWrite)(t)}: ${(0,$.plainReason)({...t.lastErr},'retry')}`:void 0})}),H.mutationQueue.onFailed(e=>Ne({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:H.mutationQueue.failed.length,...'temp_readings'===e.table||'temp_units'===e.table?{}:{refused:{what:(0,$.describeWrite)(e),why:'conflict'===e.reason?(0,$.plainReason)({code:'conflict'},'refused'):(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}}})),Le.push((0,M.onConnectivity)(e=>Ne({mode:e?Ee.getState().venueId?'live':Ee.getState().mode:Ee.getState().venueId?'offline':Ee.getState().mode}))),await Va()},Object.defineProperty(i,"BOOKINGS_POLL_MS",{enumerable:!0,get:function(){return za}}),i.serverOrder=ss,Object.defineProperty(i,"guestWords",{enumerable:!0,get:function(){return ns}}),i.nudgeGuestSync=function(){is?.()},Object.defineProperty(i,"syncInternals",{enumerable:!0,get:function(){return rs}}),i.stockSaveBlocker=os,i.stockEventStatus=function(e){if(at(e))return{state:'saved'};const t=H.mutationQueue.failed.find(t=>'stock_events'===t.table&&t.rowKey===e);return t?{state:'refused',why:(0,$.plainReason)({...t.lastErr,message:t.lastErr?.message??t.lastError},'refused')}:{state:'waiting'}},i.resendUnsavedStockEvents=ds,i.saveStockEventsNow=us,i.bookingSaveBlocker=ls,i.resendUnsavedBookings=gs,i.saveBookingsNow=ms,i.waitForBookingSave=function(e,t=12e3){if(!Ke())return Promise.resolve({state:'local'});const a=ls();if(a)return Promise.resolve({state:'refused',why:a});const s=fs()[0]?.venueId??'',n=()=>cs.some(t=>H.mutationQueue.hasPending(t,s,e));return new Promise(a=>{let s=!1;const i=[],r=e=>{s||(s=!0,i.forEach(e=>e()),clearTimeout(d),a(e))},o=()=>{const t=W.useBookingSaves.getState().notSaved[e];if(t)return r({state:'refused',why:t.why});n()||r((0,M.isOnline)()?{state:'saved'}:{state:'waiting'})};i.push(H.mutationQueue.onDone(t=>{t.rowKey===e&&setTimeout(o,0)})),i.push(H.mutationQueue.onFailed(t=>{t.rowKey===e&&setTimeout(o,0)}));const d=setTimeout(()=>r(n()||fs().some(t=>t.unsavedKeys().includes(e))?{state:'waiting'}:{state:'saved'}),t);setTimeout(()=>{n()||fs().some(t=>t.unsavedKeys().includes(e))||o()},400)})},i.tempSaveBlocker=ws,i.tempLogState=function(){const e=vs()[0]?.venueId??'',t=vs().find(e=>'temp_readings'===e.spec.table),a=H.mutationQueue.pending.filter(t=>'temp_readings'===t.table&&t.venueId===e).length,s=t&&t.spec.writable()?t.unsavedKeys().filter(t=>!H.mutationQueue.hasPending('temp_readings',e,t)).length:0,n=Object.values(Q.useTempSaves.getState().notSaved),i=ue.useSafety.getState().points??[];return{waiting:a+s,refused:n.filter(e=>'temp_readings'===e.table).length,refusedUnits:n.filter(e=>'temp_units'===e.table).map(e=>i.find(t=>t.id===e.id)?.name??'a unit'),why:n[0]?.why}},i.saveTempNow=ks,i.waitForTempSave=function(e,t,a=1e4){if(!Ke()||!vs().length)return Promise.resolve({state:'local'});const s=ws(e);if(s)return Promise.resolve({state:'refused',why:s});const n=vs()[0]?.venueId??'',i=vs().find(t=>t.spec.table===e),r=Date.now();return new Promise(s=>{const o=()=>{const d=t.map(t=>Q.useTempSaves.getState().notSaved[(0,Q.tempKey)(e,t)]).find(Boolean);if(d)return s({state:'refused',why:d.why});return t.some(t=>H.mutationQueue.hasPending(e,n,t)||!!i?.unsavedKeys().includes(t))?Date.now()-r>a?s({state:'waiting'}):void setTimeout(o,300):s({state:'saved'})};setTimeout(o,400)})},i.goLive=Os,Object.defineProperty(i,"usePublicDayStore",{enumerable:!0,get:function(){return $s}}),i.publicDay=function(e,t){const a=`${e}|${t}`,s=Bs.get(a);if('customer'!==Me||!(0,K.isSupabaseConfigured)())return null;(!s||Date.now()-s.at>6e4)&&(s?s.at=Date.now():Bs.set(a,{at:Date.now(),v:{bookings:[],blocks:[]}}),Ba('public_day',{p_venue_slug:(0,l.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:He(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:He(a.from_time),to:He(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:''})}),Bs.set(a,{at:Date.now(),v:{bookings:n,blocks:i},ok:!0}),$s.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Bs.get(a);e&&!e.ok&&Bs.delete(a)}));const n=Bs.get(a);return n?.ok?n.v:null},i.saveStaffBookingTimes=async function(e,t,a,s){const n=Ee.getState().venueId;if(!n||'staff'!==Ee.getState().kind)throw new Error('Connect to your venue first.');const i=await Ba('save_staff_booking_times',{p_venue:n,p_hours:t,p_turn:a,p_covers:s});z.useStore.getState().updateRestaurant(e,{...i,id:e})},i.staffTakeawayMenu=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return null;return(await Ba('takeaway_menu_staff',{p_venue:e})??[]).map(e=>({itemId:String(e.item_id),dish:String(e.dish??e.item_id),section:String(e.section??''),pricePence:null==e.price_pence?null:Number(e.price_pence),signedOff:!!e.signed_off,onMenu:!!e.on_menu,soldOut:!!e.sold_out}))},i.setStaffTakeawayDish=async function(e,t,a){const s=Ee.getState().venueId;if(!s||'staff'!==Ee.getState().kind)throw new Error('Connect to the venue first.');await Ba('takeaway_menu_set',{p_venue:s,p_item:e,p_on:t,p_by:a})},i.staffTakeawayCanSet=async function(){const e=Ee.getState().venueId;if(!e||'staff'!==Ee.getState().kind)return!1;try{return!0===await Ba('takeaway_menu_can_set',{p_venue:e})}catch{return!1}};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]),y=t(r[10]),h=t(r[11]),S=t(r[12]),w=t(r[13]),v=t(r[14]),k=t(r[15]),b=t(r[16]),I=t(r[17]),R=t(r[18]),O=t(r[19]),A=t(r[20]),C=t(r[21]),D=t(r[22]),U=t(r[23]),T=t(r[24]),E=t(r[25]),N=t(r[26]),P=t(r[27]),K=t(r[28]),M=t(r[29]),x=t(r[30]),q=t(r[31]),j=t(r[32]),L=t(r[33]),B=t(r[34]),$=t(r[35]),F=t(r[36]),H=t(r[37]),W=t(r[38]),Q=t(r[39]),V=t(r[40]),G=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=t(r[51]),ie=t(r[52]),re=t(r[53]),oe=t(r[54]),de=t(r[55]),ue=t(r[56]),ce=t(r[57]),le=t(r[58]),fe=t(r[59]),pe=t(r[60]),ge=t(r[61]),me=t(r[62]),_e=t(r[63]),ye=t(r[64]),he=t(r[65]),Se=(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})(he),we=t(r[66]),ve=t(r[67]),ke=t(r[68]),be=t(r[69]),Ie=t(r[70]),Re=t(r[71]),Oe=t(r[72]),Ae=t(r[73]),Ce=t(r[74]),De=t(r[75]),Ue=t(r[76]);const Te=()=>(0,P.getSupabase)();H.mutationQueue.setExecutor(B.executeMutation),(0,q.setClockServer)(()=>'staff'===Ee.getState().kind);const Ee=(0,N.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),Ne=e=>Ee.setState(e),Pe=e=>{const t=Ee.getState().perms;return t.includes('*')||t.includes(e)},Ke=()=>{const e=Ee.getState().mode;return'live'===e||'offline'===e||'connecting'===e};Ee.subscribe(()=>(0,Ae.setLiveData)(Ke()));let Me=Y.IS_CAR?'car':Y.APP_VARIANT,xe=!1;const qe=()=>{xe||((0,L.setSyncNamespace)(Me),xe=!0)};let je=[],Le=[],Be=!1;const $e=()=>(new Date).toISOString().slice(0,10),Fe=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),He=e=>e?e.slice(0,5):'',We=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],Qe=e=>JSON.parse(JSON.stringify(e));function Ve(e,t){const a=Fe(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>z.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('device.write'))},filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=Qe(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:We(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s};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,le.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:We(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s,...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('+'))}'saved-card'===s.security&&(s.security='none');const n=a;'string'==typeof n.phone&&n.phone.trim()&&(s.phone=n.phone.trim()),'string'==typeof n.email&&n.email.trim()&&(s.email=n.email.trim());const i=a;return!t&&'deposit_status'in i&&('added_to_table'===i.deposit_status?(s.depositStatus='added_to_table',s.depositAddedAt=i.deposit_added_at??s.depositAddedAt??null,s.depositAddedBy=i.deposit_added_by??s.depositAddedBy??null):(delete s.depositStatus,delete s.depositAddedAt,delete s.depositAddedBy)),s},apply:(e,t)=>z.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=>z.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function Ge(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>z.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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,le.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:Qe(e.lines??[]),allergies:We(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:Qe(e.allergyChain??{}),readiness:Qe(e.readiness??{}),allergy_ticks:Qe(e.allergyTicks??{}),handover_check:e.handoverCheck?Qe(e.handoverCheck):null,accepted:e.accepted?Qe(e.accepted):null,doc:Qe(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)=>z.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=>z.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Je(e){const t=Fe(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...te.useBlocks.getState().blocks,...te.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.to>e.from,writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e},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:Qe(e)}),fromRow:t=>{const a=t.doc&&'object'==typeof t.doc?{...t.doc}:null,s=(0,te.blockClock)(t.from_time)??a?.from,n=(0,te.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)=>te.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=>te.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Ze=null,ze='Main plan';function Ye(e){const t=e=>Qe({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(ae.useFloor.getState().plans[e]??(0,ae.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>Pe('floor.manage')||Pe('device.write'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Ze??(0,Ce.uuidFrom)(`plan:${a}`),venue_id:a,name:ze||'Main plan',is_active:!0,...t(e),updated_by:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>!0!==e.is_active?null:(Ze=String(e.id),ze=String(e.name||'Main plan'),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,De.withSeedBest)(e,t[0]):void 0;a&&ae.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>ae.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Xe(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>se.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>Pe('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,le.isUuid)(e.supplierId)?e.supplierId:(0,Ce.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),pt.get(t)??t)}:{}};var t},apply:(t,a)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const et=new Set,tt=new Set;H.mutationQueue.onDone(e=>{'stock_events'===e.table&&tt.add(e.rowKey)});const at=e=>tt.has(e)||et.has(e),st=()=>Pe('*')||Pe('staff.manage')||Pe('recipes.edit')||Pe('recipes.signoff'),nt=()=>'guest'!==Ee.getState().kind&&('device'!==Ee.getState().kind||Pe('device.write'));function it(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>se.useShellStore.getState().events.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,le.isUuid)(t.id)&&!!(se.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>{const e=Ee.getState().kind;return'guest'!==e&&'assistant'!==e&&('device'!==e||Pe('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,le.isUuid)(e.undoes)&&(at(e.undoes)||H.mutationQueue.hasPending('stock_events',t,e.undoes))?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(et.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)=>se.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=>se.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function rt(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(se.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={...se.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;se.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...et]}}}))},afterRead:()=>{se.useShellStore.getState().server[e]||se.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...et]}}}))},subscribe:()=>()=>{}}}const ot=new Set;function dt(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=z.useStore.getState().menu;return ne.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,le.isUuid)(t.card.id)&&!((0,w.isAnchorage)(e)&&(0,w.isDemoCard)(t.card))&&!(0,w.isPlaceholderCard)(t.card),writable:()=>Pe('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,w.isAnchorage)(e)&&(s={...s,signOff:(0,w.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,w.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const n=t.item&&(0,w.isAnchorage)(e)&&(0,w.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,Ce.photoPath)(a,s),t=ut(s.photo);t&&((0,ne.cachePhotoAs)(e,t),ct(e,t)),s={...s,photo:e}}const{row:i,extra:r}=(0,Ce.cardToRow)(s,a);return{...i,...r,doc:Qe({card:s,item:n})}},fromRow:t=>{const a=t.doc;if(!a?.card||(0,w.isPlaceholderCard)(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,w.isAnchorage)(e)&&(0,w.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(!Pe('recipes.edit')&&t.length){const e=new Set(t);ne.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);ne.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&&z.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&&z.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=ne.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=z.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const ut=e=>(0,ne.readLocalPhoto)(e);async function ct(e,t){if(!ot.has(e)){ot.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){ot.delete(e),Ne({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const lt=new Map,ft=(0,N.create)(()=>({n:0}));(0,ne.setStoragePhotoResolver)(e=>{const t=lt.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,K.isSupabaseConfigured)()&&'off'!==Ee.getState().mode?(t||(lt.set(e,{url:'',at:Date.now()}),Te().storage.from(Ce.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(lt.set(e,{url:t.signedUrl,at:Date.now()}),ft.setState(e=>({n:e.n+1})),ne.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const pt=new Map;const gt=(e,t)=>{const a=(0,le.isUuid)(t)?t:(0,Ce.uuidFrom)(`sup:${e}:${t}`);return pt.set(a,t),a};function mt(e){return{name:'order_sheets',table:'suppliers',list:()=>ie.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,w.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>Pe('suppliers.manage'),toRow:(e,t)=>({id:gt(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:Qe(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(pt.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>ie.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=>ie.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,le.isUuid)(e)?e:(0,Ce.uuidFrom)(`sup:${Ee.getState().venueId}:${e}`)})}}let _t=!1,yt=!1;const ht=new Map,St=new Map,wt=new Map,vt=new Map,kt=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',bt=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'},It=(e,t)=>({...e,managerAccess:t}),Rt=()=>({nickname:_t,display:yt}),Ot=e=>{const t=!!(e.temp&&e.tempUntil&&e.tempUntil<(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'})),a=It({role:e.role,level:e.level??bt(kt(e)).level},!0===e.managerAccess);return(0,F.staffSyncItem)({...e,...a,active:!t&&e.active,ownerAccess:!0===e.ownerAccess},Rt())};const At=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Ct=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},Dt=e=>{const t=ce.useOwner.getState().staff.find(t=>t.id===e);return!!t&&(0,u.isKitchenTeam)(t)},Ut=2e3;function Tt(e,t){return t||!e.length||e.length>=Ut?null:e=>(0,le.isUuid)(e.id)}function Et(e=!1){return{name:'rota',table:'rota_shifts',authoritative:t=>e?Tt(t,Pe('rota.manage')):null,keepOnEmpty:()=>e&&!Pe('rota.manage'),list:()=>ce.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&ht.has(e.staffId)&&(Pe('rota.manage')||Dt(e.staffId)),writable:()=>Pe('rota.manage')||Pe('rota.kitchen'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(At());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Ct(e.start),end_time:Ct(e.end),published:!!e.published,doc:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function Nt(){const e=Fe(62),t=e=>Pe('rota.manage')||e.staffId===Ee.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>ce.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&t(e),writable:()=>'staff'===Ee.getState().kind,deletes:!1,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,writeBeforeRead:!0,urgent:e=>e.date>=Fe(2)&&e.staffId===Ee.getState().staffRef&&!e.adjusted&&!e.signOff&&!e.voided,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,clock_in:e.in??null,clock_out:e.out??null,breaks:Qe(e.breaks??[]),break_mins:e.breakMins??0,doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,e))}),fromRow:e=>{if(!e.doc)return null;const t=(0,v.privateAttendance)(ee.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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function Pt(){const e=Fe(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&e.staffId===Ee.getState().staffRef&&'open'===e.status,writable:()=>'staff'===Ee.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:ht.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,le.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:Qe({...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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function Kt(e){ce.leaveRemote.decide=t=>!(!Pe('rota.manage')||!(0,le.isUuid)(t.id)||'approved'!==t.status&&'declined'!==t.status)&&(H.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),Le.push(()=>{ce.leaveRemote.decide=null})}function Mt(e){ce.timesheetRemote.send=(t,a)=>{if(!Pe('rota.manage')||!(0,le.isUuid)(a.id))return!1;if('time_request_resolve'===t){const s=a;return H.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:Qe(s)}}),!0}const s=a;if('attendance_void'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e,p_reason:s.voided?.reason??'Removed',p_void:!0}}),!0;if('attendance_delete'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_venue:e}}),!0;if('attendance_add_past'===t)return!(!s.in||!s.out)&&(H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,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,p_break_mins:s.breakMins??0,p_note:s.adjusted?.reason??'',p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0);if('attendance_confirm'===t)return H.mutationQueue.enqueue({table:'attendance',venueId:e,kind:'rpc',fn:t,rowKey:s.id,values:{p_id:s.id,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0;if(!s.in)return!1;const n=s.adjusted?.reason??'';return H.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:Qe(s.breaks??[]),p_reason:n,p_doc:Qe((0,v.privateAttendance)(ee.VENUE_RID,s))}}),!0},Le.push(()=>{ce.timesheetRemote.send=null})}function xt(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>z.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===Ee.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,le.isUuid)(a)?a:(0,Ce.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,le.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:Qe(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>z.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=>z.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const qt=e=>z.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function jt(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}));z.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function Lt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=z.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[Qe({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:ae.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:qt(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>Pe('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...$t??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...$t?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...$t?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...Bt??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{Bt=t.feature_flags??{},$t=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}),Qe({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&&(z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&a.restaurant?(0,f.withVenueAddress)({...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&&ae.useFloor.setState(t=>({settings:{...t.settings,[e]:a.display}})),a.events&&jt(e,a.events))},subscribe:e=>{const t=z.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=ae.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let Bt=null,$t=null;const Ft=()=>new Date(Date.now()-2592e6).toISOString(),Ht=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>ht.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},Wt=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>St.get(e));return 2===t.length&&t[0]&&t[1]?(0,be.dmId)(t[0],t[1]):null},Qt=()=>Ee.getState().perms.includes('*');function Vt(){const e=()=>Ee.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>ce.useOwner.getState().chat.filter(e=>(0,le.isUuid)(e.id)).map(e=>Qe({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=>!!Ht(t.ch)&&(t.from===e()||Qt()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===Ee.getState().kind,filter:e=>e.gte('created_at',Ft()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=Ft(),toRow:(e,t)=>{const a=Ht(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:ht.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=Wt(String(e.channel));if(!t)return null;const a=String(e.from_device??''),s='car'===a?'car-device':'display'===a?'display-device':e.from_staff?St.get(String(e.from_staff)):'system';return s?Qe({id:String(e.id),ch:t,from:s,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=String(t.from_device??''),n='car'===s?'car-device':'display'===s?'display-device':t.from_staff?St.get(String(t.from_staff)):'system',i=Wt(String(t.channel)),r=e();if(!i||!r||n===r||Date.now()-new Date(t.created_at).getTime()>12e4)return;const o=ce.useOwner.getState();if((o.chatMuted[r]??[]).includes(i))return;if(!(0,be.inChannel)(i,o.staff.find(e=>e.id===r)))return;if((0,Ie.soundAllowed)())try{(0,Ie.chime)('soft')}catch{}const d='car-device'===n?'Car':'display-device'===n?'Display':'system'===n?'CoverCharge':o.staff.find(e=>e.id===n)?.name?.replace(' (example)','')??'The team',u=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,c=String(t.body??t.text??'').slice(0,120);(0,I.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${d} ${u}`,body:c||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}async function Gt(e,t,a){const s=Ee.getState();if(!ke.useChatSync.getState().synced||!s.venueId||'staff'!==s.kind||s.staffRef!==e)return;const n=ht.get(e),i='*'===t?'*':Ht(t);if(n&&i)try{await Te().from('chat_reads').upsert({venue_id:s.venueId,staff_id:n,channel:i,read_at:a},{onConflict:'staff_id,channel'})}catch{}}async function Jt(e){const t=Ee.getState().staffRef,a=t?ht.get(t):void 0;if(t&&a)try{const{data:s,error:n}=await Te().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?'*':Wt(String(e.channel));t&&(i[t]=new Date(e.read_at).toISOString())}Object.keys(i).length&&ce.useOwner.getState().chatMarkRead(t,i)}catch{}}function Zt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=T.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:Qe(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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)=>T.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,E.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=>T.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function zt(e){const t=Fe(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>T.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.reminderId)&&e.staffRef===Ee.getState().staffRef,writable:()=>'staff'===Ee.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)=>T.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=>T.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function Yt(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 Xt=e=>null==e||''===e?null:Number(e),ea=e=>e.filter(e=>!e.startsWith('data:')),ta=()=>Pe('takings.view');function aa(e){const t=!ta();return{name:'cash_ups',table:'cash_ups',list:()=>pe.useCashUp.getState().cashUps.filter(a=>a.rid===e&&(!t||a.date===(0,b.tradingDay)())),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt&&(!t||e.date===(0,b.tradingDay)()&&!e.onServer),writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,filter:e=>t?e.eq('for_date',(0,b.tradingDay)()):e.gte('for_date',Fe(400)),...t?{inWindow:e=>e.date===(0,b.tradingDay)()}:{},toRow:(e,t)=>(0,C.cashUpToRow)(e,t),fromRow:t=>(0,C.cashUpFromRow)(t,e),apply:(t,a)=>pe.useCashUp.setState(s=>({cashUps:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function sa(e){return{name:'sales_reports',table:'sales_reports',list:()=>pe.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>Pe('wages.manage')||(0,k.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:Qe(e.vals),categories:e.categories,photos:ea(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)=>pe.useCashUp.setState(s=>({sales:Yt(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=>pe.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function na(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=pe.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,pe.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:Qe({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,pe.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>pe.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function ia(e){return{name:'day_tips',table:'day_tips',list:()=>pe.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',Fe(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=>pe.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=>pe.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function ra(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>pe.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Xt(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>pe.useCashUp.setState(s=>({pot:Yt(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function oa(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=pe.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>Pe('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=>pe.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>pe.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function da(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>fe.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:Qe(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>fe.useNotifs.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>fe.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function ua(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=ge.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,le.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:Qe(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:Qe(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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)=>ge.useOrderLists.setState(s=>{const n={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))n[e]={...me.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:Yt(s.lists,i,a,t=>t.rid===e)}}),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function ca(e){const t=()=>Pe('venue.settings')||Pe('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>ge.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,le.isUuid)(a.id)&&(0,le.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,ge.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===Ee.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:Ee.getState().staffRef)||null,doc:Qe(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)=>ge.useOrderLists.setState(s=>({items:Yt(s.items,t,a,t=>t.rid===e)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function la(e){const t=Fe(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>ge.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('venue.settings')||Pe('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:Qe(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>ge.useOrderLists.setState(s=>({history:Yt(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>ge.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function fa(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=_e.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:Qe(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>Pe('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&&_e.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,v.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>_e.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function pa(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=we.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,we.libraryRowId)(e),kind:'library',doc:Qe({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,we.personRowId)(e,i),kind:'person',staffRef:i,doc:Qe({tasks:n.tasks,updatedAt:n.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=ce.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,ve.canEditTasks)(t,a)},writable:()=>'staff'===Ee.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=>we.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,we.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:n}}),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function ga(e){const t=Fe(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>we.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=Ee.getState();return e.byRef===t.staffRef||Pe('staff.manage')},writable:()=>'staff'===Ee.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)=>we.useDailyTasks.setState(s=>({ticks:Yt(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>we.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function ma(e,t=!1){const a=Fe(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>Re.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind||Pe('device.write'),filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,Ce.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)=>Re.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=>Re.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{Oe.autoSync.soldOutRead.add(e)}}}function _a(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>Oe.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===Ee.getState().kind,toRow:(e,t)=>({id:(0,Ce.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)=>Oe.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=>Oe.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{Oe.autoSync.linksRead.add(e)}}}async function ya(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([Te().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return n?!!/fetch|network|Failed/i.test(n.message)&&L.kv.get(a,!1):(L.kv.set(a,!0),!0)}catch{return L.kv.get(a,!1)}}async function ha(){const e=Ee.getState().venueId;if(e)try{const{data:t}=await Te().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();va.setState({live:!!t?.push_live,known:!0})}catch{}}const Sa='order-list-logos';const wa=new Map;const va=(0,N.create)(()=>({live:!1,known:!1}));async function ka(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('reminders:ok',!1):(L.kv.set('reminders:ok',!0),!0)}catch{return L.kv.get('reminders:ok',!1)}}async function ba(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([Te().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&L.kv.get('chat:ok',!1):(L.kv.set('chat:ok',!0),!0)}catch{return L.kv.get('chat:ok',!1)}}const Ia=(e,t)=>Qe({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)}),Ra='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Oa(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>U.useHr.getState().questions.filter(t=>t.venue===e&&(0,le.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>Ia(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);U.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=>U.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Aa(e,t){const a=(t,a,s)=>{H.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(U.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 Te().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 Te().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 Te().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 Te().from('hr_questions').select(Ra).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||U.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>Ia(e,t)))}catch{}}}),Le.push(()=>{Object.assign(U.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Ca='pair:v1',Da='staff:v1',Ua='staff:rejoin:v1';async function Ta(e){const t=(0,p.claimInviteRpc)(),a={p_token:e,p_app:Me,p_device:(0,D.deviceId)()},s=await Te().rpc(t,{...a,p_phone:(0,D.phoneKey)()});return s.error&&('PGRST202'===s.error.code||/could not find the function/i.test(s.error.message))?Te().rpc(t,a):s}async function Ea(){if('display'===Me||'customer'===Me||ye.PITCH)return'none';const e=await L.kv.get(Ua,null);if(!e)return'none';try{await Pa();const{data:t,error:a}=await Ta(e);if(a)return(0,O.inviteRefusal)(a.message)?(await L.kv.remove(Ua),await L.kv.remove(Da),'refused'):'offline';const s=t?.[0];return s?(await L.kv.set(Da,{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 L.kv.remove(Ua),'refused')}catch{return'offline'}}const Na=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 Pa(){qe();const{data:e}=await Te().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await Te().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}Ne({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 Ka(e){if(ye.PITCH)return{status:'refused',message:/^pitch-other-phone/.test(e)?(0,O.inviteRefusal)('already linked to another phone'):'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,K.isSupabaseConfigured)())return{status:'off'};try{await Pa();const{data:t,error:a}=await Ta(e);if(a){const e=(0,O.inviteRefusal)(a.message);if(e){try{localStorage.removeItem((0,ee.venueKey)(`cc-pending-invite:${Me}`))}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 L.kv.set(Da,n),await L.kv.set(Ua,e),Be&&Ha(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return Ne({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}const Ma='car:request:v1',xa=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 qa(){await L.kv.remove(Ca),await L.kv.remove(Da),await L.kv.remove(Ma),D.useSession.getState().meId&&D.useSession.getState().signOut()}const ja=e=>{const t=String(e?.message??e);return/fetch|network/i.test(t)?'No connection. Check your signal and try again.':t.replace(/^.*?:\s*(?=[A-Z])/,'')};async function La(){if(!(0,K.isSupabaseConfigured)())return!1;try{return await Pa(),!0}catch{return!1}}const Ba=async(e,t={})=>{if(ye.PITCH)return(0,he.pitchRpc)(e,t);const{data:a,error:s}=await Te().rpc(e,t);if(s)throw s;return a};let $a=null;async function Fa(){for(const e of Le)try{e()}catch{}Le=[],je.forEach(e=>e.stop()),je=[],$a&&(clearInterval($a),$a=null)}async function Ha(){await Fa(),await Va()}async function Wa(){if(!(0,K.isSupabaseConfigured)()||'customer'===Me||ye.PITCH)return!1;try{qe();const{data:e}=await Te().auth.getSession();if(e.session){const{error:e}=await Te().auth.refreshSession();if(!e)return!0}if('display'===Me)return!1;if(!await L.kv.get(Ua,null))return!1;if(e.session)try{await Te().auth.signOut({scope:'local'})}catch{}return'ok'===await Ea()&&(Ha(),!0)}catch{return!1}}(0,c.setSessionMender)(Wa);let Qa=ee.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=Qa;try{if(Ne({mode:'connecting'}),await H.mutationQueue.load(),'customer'===Me)return void await Xa(e);let t=await L.kv.get(Ca,null),a=await L.kv.get(Da,null);if(Y.IS_CAR&&!t&&a){const e=(0,X.migrateCarStaffIdentity)(a);e&&(t=e,await L.kv.set(Ca,t)),await L.kv.remove(Da),a=null,D.useSession.getState().meId&&D.useSession.getState().signOut()}if(ee.IS_ISOLATED_VENUE&&(t&&!(0,ee.venueIdentityAllowed)(t.venueId,t.venueSlug)||a&&!(0,ee.venueIdentityAllowed)(a.venueId,a.venueSlug)))return void Ne({mode:'display'===Me?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:s}=await Te().auth.getSession();if('display'!==Me&&!Y.IS_CAR&&a&&!s.session){const t=await Ea();if('offline'===t)return Ne({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(()=>{Qa===e&&Ha()},6e4);'refused'===t&&a.staffRef&&D.useSession.getState().meId===a.staffRef&&D.useSession.getState().signOut(),a=await L.kv.get(Da,null),({data:s}=await Te().auth.getSession())}const n='display'===Me||Y.IS_CAR?t:a;if(!s.session||!n)return void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[]});let i=[];try{const e=(await Ba('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===Me||Y.IS_CAR?await L.kv.remove(Ca):(await L.kv.remove(Da),await L.kv.remove(Ua)),'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId===n.staffRef&&D.useSession.getState().signOut(),void Ne({mode:'display'===Me||Y.IS_CAR?'unpaired':'signin',perms:[],message:'display'===Me?'This display was unpaired by a manager.':Y.IS_CAR?'This car was unpaired by an owner. Make a new code and approve it from Managers.':'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,M.isOnline)()||/fetch|network/i.test(String(t?.message)))Ne({mode:'offline'});else if(Na(t)&&'display'!==Me){const{error:t}=await Te().auth.refreshSession();t&&'ok'===await Ea()&&setTimeout(()=>{Qa===e&&Ha()},500)}i=Ee.getState().perms,'device'===n.kind&&n.canWrite&&!i.includes('device.write')&&(i=[...i,'device.write'])}Ne({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:i}),!Y.IS_CAR&&'staff'===n.kind&&n.staffRef&&D.useSession.getState().meId!==n.staffRef&&(D.useSession.getState().signIn(n.staffRef),ce.useOwner.setState({staffAs:n.staffRef})),Y.IS_CAR&&(D.useSession.getState().meId&&D.useSession.getState().signOut(),ce.useOwner.setState({previewRole:'owner'})),await Ja(n.venueId,e,n.kind)}catch(e){Ne({mode:'local',lastError:String(e?.message??e)})}}const Ga=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 Ja(e,a,s){if(!(0,ee.venueIdentityAllowed)(e,a))throw new Error('Different venue: sync refused.');const n='staff'===s||Y.IS_CAR&&'device'===s;await Os(a),Le.push(Ls(e));try{const{data:t}=await Te().from('roles').select('id,key').eq('venue_id',e);for(const e of t??[])wt.set(e.key,e.id),vt.set(e.id,e.key)}catch{}const i=[Lt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>ce.useOwner.getState().staff.map(Ot),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>Pe('staff.manage'),deletes:!1,revision:e=>(0,F.staffRevision)(e,Rt()),toRow:(e,t)=>(0,F.staffRow)(e,t,Rt(),e.managerAccess||e.ownerAccess?null:wt.get(kt(e))),fromRow:e=>{if(!e.external_ref)return null;ht.set(String(e.external_ref),String(e.id)),St.set(String(e.id),String(e.external_ref)),Ms.set(String(e.external_ref),e.avatar_path??null);const t=It(bt(vt.get(String(e.role_id))),!0===e.manager_access);return(0,F.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},Rt())},apply:e=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{js()},onRemote:()=>{js()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=ce.useOwner.getState(),t=oe.useSetup.getState().sites[Qa]?.staffGrade??{};return e.staff.filter(e=>ht.has(e.id)).map(a=>Qe({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=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:ht.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=St.get(String(e.staff_id));return t?Qe({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=>ce.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=oe.useSetup.getState().sites[Qa],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&&oe.useSetup.getState().patch(Qa,{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=ce.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=oe.useSetup.subscribe((t,a)=>{t.sites[Qa]?.staffGrade!==a.sites[Qa]?.staffGrade&&e()});return()=>{t(),a()}}},Ve(a,!1),Ve(a,!0),Je(a),Ye(a),Ge(a),Xe(a),it(a),rt(a),mt(a),{name:'supplier_directory',table:'suppliers',list:()=>ce.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,le.isUuid)(e.id),writable:()=>Pe('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:Qe(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>ce.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId),writable:()=>Pe('suppliers.order')||Pe('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||$e(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:Qe(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},dt(a),Ns(a)];Pe('wages.view')&&i.push(Ps(a)),n&&(i.push(Et(!0),Nt(),Pt(),xt(a)),Mt(e)),n&&await ya('staff_leave')&&(i.push({name:'staff_leave',table:'staff_leave',mode:'insert',deletes:!1,list:()=>ce.useOwner.getState().leave,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,le.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===Ee.getState().staffRef&&'pending'===e.status||Pe('rota.manage')),writable:()=>'staff'===Ee.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:Qe(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)=>ce.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=>ce.useOwner.subscribe((t,a)=>{t.leave!==a.leave&&e()})}),Ga.add('staff_leave'),Kt(e));const o=n&&await ba();if(ke.useChatSync.setState({synced:o,checked:!0}),Le.push(()=>ke.useChatSync.setState({synced:!1})),o&&i.push(Vt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(be.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>St.get(String(e.staff_id))??String(e.staff_id),syncable:e=>ht.has(e.id),writable:()=>Pe('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:ht.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:ht.get(e.id),include:e.include}),fromRow:e=>{const t=St.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>be.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=>be.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),n&&await ya('hr_questions')&&(i.push(Oa(a)),Ga.add('hr_questions'),Aa(e,a)),'guest'!==s&&'customer'!==Me&&await ya('temp_readings')&&(i.push((0,V.tempUnitsSpec)(ue.useSafety,st),(0,V.tempReadingsSpec)(ue.useSafety,nt)),Ga.add('temp_units'),Ga.add('temp_readings')),'guest'!==s&&'customer'!==Me&&await ya('cooksafe_records')&&(i.push((0,G.cooksafeSpec)(ue.useSafety,J.useCookSafe,ue.isSeedAccident,nt)),Ga.add('cooksafe_records')),'guest'!==s&&await ya('sold_out_items')?(i.push(ma(a,await ya('sold_out_items','auto'))),Ga.add('sold_out_items')):Oe.autoSync.soldOutRead.add(a),'guest'!==s&&await ya('sold_out_links')?(i.push(_a(a)),Ga.add('sold_out_links')):Oe.autoSync.linksRead.add(a),T.useReminders.getState().ensure(a),'guest'!==s&&await ka()&&(i.push(Zt(a)),n&&i.push(zt(a))),fe.useNotifs.getState().ensure(a),ge.useOrderLists.getState().ensure(a),n){_t=await ya('staff','nickname'),yt=await ya('staff','display_clock');const[e,t,s,n]=await Promise.all([ya('scheduled_notifications'),ya('order_lists'),ya('venue_clock_area'),ya('daily_tasks')]);we.useDailyTasks.getState().ensure(a),n&&(i.push(pa(a),ga(a)),Ga.add('daily_tasks'),Ga.add('daily_task_ticks')),e&&(i.push(da(a)),ha()),t&&i.push(ua(a),ca(a),la(a)),s&&i.push(fa(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&&Ga.add(n)}if('guest'!==s&&await ya('day_tips')){i.push(ia(a));for(const e of['day_tips','tips_pot_events','tips_settings'])Ga.add(e);await ya('tips_pot_events')&&i.push(ra(a),oa(a)),n&&(ta()||(0,pe.forgetPastTakings)(a,(0,b.tradingDay)()),i.push(aa(a),na(a)),Ga.add('cash_ups'),ta()&&(i.push(sa(a)),Ga.add('sales_reports')),t(r[78])(r[77],r.paths).then(e=>e.refreshCashAccess()))}'device'!==s||n||(i.push(Et(),Nt()),await ya('scheduled_notifications')&&i.push(da(a)));let d=!1;const u=()=>{if(Y.IS_CAR&&n&&Pe('recipes.edit'))return!0;const e=ce.useOwner.getState().staff.find(e=>e.id===Ee.getState().staffRef);return!!e&&e.active&&Pe('recipes.edit')&&(0,h.costsAllowedFor)(e)};n&&u()&&await ya('ingredient_prices')&&(i.push((0,y.gpSyncSpec)('ing',u)),Ga.add('ingredient_prices'),await ya('card_costs')&&(i.push((0,y.gpSyncSpec)('card',u)),Ga.add('card_costs')),await ya('kitchen_deliveries')&&(i.push((0,y.gpSyncSpec)('del',u)),Ga.add('kitchen_deliveries')),await ya('kitchen_stock_counts')&&(i.push((0,y.gpSyncSpec)('count',u)),Ga.add('kitchen_stock_counts'))),(0,Ue.specialsSyncOn)()&&'guest'!==s&&await ya('specials_boards')&&(i.push((0,Ue.specialsBoardSpec)(a,()=>Pe('recipes.edit')||Pe('floor.manage')||Pe('*'))),Ga.add('specials_boards'));const c={onActivity:()=>Ne({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>Ne({lastError:`${e}: ${t}`}),onSuspect:(t,s)=>{Ne({lastError:`${t}: held back, ${s}`}),d||(d=!0,(async()=>{try{if(!(await Ba('whoami')??[]).some(t=>t.venue_id===e))return void(Qa===a&&Ha());for(const a of je){if(a.spec.name!==t)continue;const{count:s,error:n}=await Te().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}})())},onSkipped:(e,t)=>{'bookings'!==e&&'walk_ins'!==e||W.useBookingSaves.getState().mark({id:t,table:e,why:ls()??'this screen could not send it'}),'temp_readings'!==e&&'temp_units'!==e||Q.useTempSaves.getState().mark({id:t,table:e,why:ws(e)??'this screen could not send it'})}};je=i.map(t=>new Z.EntityBridge(t,e,c)),await Promise.all(je.map(e=>e.start()));let l=0;const f=async()=>{if(!(l&&Date.now()-l<6e4)){l=Date.now();try{await p()}finally{l=0}}},p=async()=>{if(n&&(0,M.isOnline)())try{const t=await Ba('whoami');if(!t?.some(t=>t.venue_id===e))return void(Qa===a&&Ha())}catch(e){if(Na(e)){if(Y.IS_CAR)return void(Qa===a&&Ha());const e=await Ea();return void('ok'!==e&&'refused'!==e||Qa===a&&Ha())}}let t=0;for(const[a,s]of je.entries()){const n='chat'===i[a]?.name;try{await s.read(),t++,n&&(ke.useChatSync.getState().error&&ke.useChatSync.setState({error:void 0}),await Jt(e))}catch(e){const t=String(e?.message??e);if((n||/fetch|network|Failed/i.test(t))&&ke.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(t){const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({mode:'live',lastSyncAt:e,lastServerAt:e}),H.mutationQueue.flush()}else Ne({mode:'offline'});if(!Pe('wages.view')){const e=Ee.getState().staffRef;ce.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await Promise.race([f(),new Promise(e=>setTimeout(e,3e4))]);const g=new Map;for(const e of je)g.set(e.spec.table,[...g.get(e.spec.table)??[],e]);const m=[...g.keys()].filter(e=>Ga.has(e)).map(e=>({table:e,venueColumn:g.get(e)[0].spec.venueColumn}));let _=!1;const S=(0,Z.venueChannel)(e,m,(e,t,a)=>{for(const s of g.get(e)??[])s.remote(t,a);const s=(new Date).toISOString();Ne({lastSyncAt:s,lastServerAt:s})},e=>{Ne({realtime:e}),'SUBSCRIBED'===e?(_&&f(),_=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(_=!0)});Le.push(()=>{Te().removeChannel(S)}),Le.push((0,M.onConnectivity)(e=>{e&&f()}));const w=je.filter(e=>'bookings'===e.spec.table||'walk_ins'===e.spec.table),v=(0,x.superviseSync)({fastMs:za(Me),readFast:async()=>{for(const e of w)await e.read()},readAll:f,flush:()=>{H.mutationQueue.flush()},wake:()=>{H.mutationQueue.retryNow()},restart:()=>{Qa===a&&Ha()},realtime:()=>Ee.getState().realtime,lastServerAt:()=>{const e=Ee.getState().lastServerAt;return e?Date.parse(e):0},markServer:()=>{const e=(new Date).toISOString();(0,M.setOnline)(!0),Ne({lastSyncAt:e,lastServerAt:e,mode:'live'})},isAuthError:Na,refreshAuth:async()=>{await Te().auth.refreshSession()},heartbeat:()=>Za(e),doc:'undefined'!=typeof document?document:null,win:'undefined'!=typeof window?window:null});Le.push(v.stop)}async function Za(e){const t=Ee.getState(),a='undefined'!=typeof navigator?String(navigator.userAgent??''):'';await Ba('sync_heartbeat',{p_venue:e,p_device:(0,D.deviceId)()??'unknown',p_app:Me,p_version:j.APP_VERSION,p_last_synced_at:t.lastServerAt??null,p_realtime:t.realtime??null,p_pending:(t.waiting??0)+(t.pending??0),p_failed:t.failed??0,p_user_agent:a.slice(0,300)})}const za=e=>'display'===e?15e3:3e4;'undefined'!=typeof window&&(window.__ccSync=()=>({...Ee.getState(),queue:H.mutationQueue.pending.map(e=>e.table),failedTables:H.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}),ye.PITCH&&(window.__ccSyncPreview=e=>Ne(e)));const Ya='guest:sent:v1';async function Xa(e){Ne({kind:'guest',venueSlug:e,perms:[]});try{const t=(await Ba('public_venue',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)}))?.[0];if(t&&(!ee.IS_ISOLATED_VENUE||t.id===ee.VENUE_UUID)){Ne({venueId:t.id,venueName:t.name}),await Os(e);const a=t.app?.restaurant;a&&z.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e?(0,f.withVenueAddress)({...a,id:e}):t)})),jt(e,t.app?.events)}await es(e),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{Ne({mode:(0,M.isOnline)()?'local':'offline'})}const t=setInterval(()=>{es(e).catch(()=>{})},6e4);Le.push(()=>clearInterval(t)),ee.IS_ISOLATED_VENUE||await ts(e)}async function es(e){const t=await Ba('public_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];if(t.length){const a=new Map(t.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));ne.useCardStore.setState(t=>({cards:t.cards.map(t=>{if(t.restaurantId!==e)return t;const s=a.get(t.menuItemId);return s?{...(0,d.applyServerCard)(t,s),photo:s.photo_url||void 0}:t.signOff?{...t,signOff:null}:t})}))}const a=t.map(t=>(0,d.serverItem)(t,e)).filter(e=>!!e);a.length&&z.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))]}});try{const t=await Ba('public_takeaway_menu',{p_venue_slug:(0,l.queuedDatabaseSlug)(e)})??[];o.useTakeawayMenu.getState().set(e,{on:t.filter(e=>e.on_menu).map(e=>String(e.item_id)),soldOut:t.filter(e=>e.sold_out).map(e=>String(e.item_id)),at:(new Date).toISOString()})}catch{}}async function ts(e){let t=await L.kv.get(Ya,{}),a=!1;const s=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!a){a=!0;try{const a=z.useStore.getState(),n=a.bookings.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!a.walkIn&&!t[a.id]&&a.createdAt>=s),i=a.orders.filter(a=>a.restaurantId===e&&(0,le.isUuid)(a.id)&&!t[a.id]&&a.createdAt>=s&&'table'!==a.type);if(n.length||i.length){if(!await La())return;for(const a of n)try{const s=(await Ba('guest_create_booking',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_booking:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(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&&z.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'},Ne({lastError:`Booking: ${e?.message}`}))}for(const a of i)try{const s=(await Ba('guest_create_takeaway',{p_venue_slug:(0,l.queuedDatabaseSlug)(e),p_order:{...Qe(a),...(0,R.takeGuard)(a.id),allergies:We(a.allergies)}}))?.[0];if(t={...t,[a.id]:'order'},s&&z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?ss(e,s):e)})),'boolean'==typeof a.marketingOptIn&&a.email)try{await Ba('guest_marketing_consent',{p_order:a.id,p_opt_in:a.marketingOptIn})}catch{}}catch(e){const s=String(e?.message??'');/fetch|network/i.test(s)||(t={...t,[a.id]:'failed'},Ne({lastError:`Order: ${s}`}),z.useStore.setState(e=>({orders:e.orders.map(e=>e.id===a.id?{...e,status:'cancelled',payment:{state:'refused',error:ns(s)}}:e)})))}await L.kv.set(Ya,t)}for(const e of a.bookings)if('booking'===t[e.id]&&'cancelled'===e.status)try{await Ba('guest_cancel_booking',{p_id:e.id}),t={...t,[e.id]:'cancelled'},await L.kv.set(Ya,t)}catch{}if(Object.values(t).some(e=>'booking'===e||'order'===e)){const e=await Ba('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));z.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=ss(e,a);return as(s)===as(e)?e:s})})),Ne({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{Ne({mode:(0,M.isOnline)()?Ee.getState().mode:'offline'})}finally{a=!1}}};Le.push(z.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),$a=setInterval(()=>{n()},15e3),is=()=>{n()},n()}const as=e=>JSON.stringify([e.status,e.readyBy,e.accepted,e.payment,e.total,e.paid,e.ref]);function ss(e,t){const a=t.doc??{},s=(e,t)=>'number'==typeof e&&Number.isFinite(e)?e:t;return{...e,status:t.status??a.status??e.status,readyBy:a.readyBy??e.readyBy,accepted:a.accepted??e.accepted,...a.payment?{payment:a.payment}:{},...Array.isArray(a.lines)&&a.lines.length?{lines:a.lines}:{},subtotal:s(a.subtotal,e.subtotal),total:s(a.total,e.total),paid:s(a.paid,e.paid),tip:s(a.tip,e.tip),giftCardApplied:s(a.giftCardApplied,e.giftCardApplied),ref:'string'==typeof a.ref&&a.ref?a.ref:'string'==typeof t.ref&&t.ref?t.ref:e.ref}}const ns=e=>{const t=e.replace(/^.*?:\s*(?=[A-Z])/,'').trim();return/^[A-Z][^{}<>]{3,200}[.!?]$/.test(t)?t:'The restaurant\u2019s system couldn\u2019t take this order. Nothing has been charged. Please try again or ring the restaurant.'};let is=null;const rs={bridges:()=>je,restart:Ha};function os(){const e=Ee.getState();return'offline'===e.mode?'there is no connection right now. It saves by itself when the connection is back':'live'!==e.mode&&'connecting'!==e.mode?'this screen is not connected to the shared venue':'guest'===e.kind||'device'===e.kind&&!Pe('device.write')?'this screen can only read. A manager can allow changes for it in Managers':null}function ds(){const e=je.find(e=>'stock_events'===e.spec.table);if(!e||os())return 0;const t=new Date(Date.now()-2592e5).toISOString();let a=0;for(const s of[...e.spec.list()].sort((e,t)=>e.at.localeCompare(t.at)))s.at'stock_events'===e.table&&e.rowKey===s.id)&&e.spec.syncable(s)&&(H.mutationQueue.enqueue({table:'stock_events',venueId:e.venueId,kind:'insert',rowKey:s.id,values:e.spec.toRow(s,e.venueId),conflictKey:'id'}),a++);return a}async function us(){const e=je.find(e=>'stock_events'===e.spec.table);if(e)try{await e.read()}catch{}ds();try{await H.mutationQueue.retryNow()}catch{}}Ee.subscribe((e,t)=>{e.perms!==t.perms&&e.perms.includes('device.write')&&!t.perms.includes('device.write')&&setTimeout(()=>{us()},3e3)});const cs=['bookings','walk_ins'];function ls(){const e=Ee.getState();return Ke()?'guest'===e.kind?'this screen can only read bookings, so the change would stay on this screen only':'device'!==e.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'unpaired'===e.mode||'signin'===e.mode?'this screen is not connected to the venue, so the change would stay on this screen only':null}const fs=()=>je.filter(e=>cs.includes(e.spec.table)),ps=e=>H.mutationQueue.failed.some(t=>cs.includes(t.table)&&t.rowKey===e);function gs(e=!1){return ls()?0:fs().reduce((t,a)=>t+a.resendUnsaved(t=>!e&&ps(t)&&!!W.useBookingSaves.getState().notSaved[t]),0)}async function ms(e=!1){const t=ls();if(t)return t;for(const e of fs())try{await e.read()}catch{}gs(e);try{await H.mutationQueue.retryNow()}catch{}return e&&_s(),null}function _s(){const e=fs()[0]?.venueId??'',t=W.useBookingSaves.getState(),a=new Set(fs().flatMap(e=>e.unsavedKeys()));for(const s of Object.keys(t.notSaved))a.has(s)||ps(s)||cs.some(t=>H.mutationQueue.hasPending(t,e,s))||t.clear(s)}H.mutationQueue.onFailed(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{cs.includes(e.table)&&W.useBookingSaves.getState().clear(e.rowKey)});let ys=null;const hs=(e=2500)=>{ys&&clearTimeout(ys),ys=setTimeout(()=>{ys=null,ms(!1)},e)};(0,M.onConnectivity)(e=>{e&&hs()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&hs(3e3)});const Ss=['temp_readings','temp_units'];function ws(e="temp_readings"){const t=Ee.getState();return Ke()?'guest'===t.kind?'this screen can only read the food safety log':'temp_units'!==e||st()?'device'!==t.kind||Pe('device.write')?null:'this screen can only read. A manager can allow changes for it in Managers \u203a Displays':'only the Head Chef, managers and owners can change the units':'unpaired'===t.mode||'signin'===t.mode?'this screen is not connected to the venue, so it is kept on this screen only':null}const vs=()=>je.filter(e=>Ss.includes(e.spec.table));async function ks(e=!1){const t=ws();if(t)return t;for(const e of vs())try{await e.read()}catch{}const a=vs()[0]?.venueId??'';for(const t of vs())t.resendUnsaved(a=>{return!e&&(s=t.spec.table,n=a,H.mutationQueue.failed.some(e=>e.table===s&&e.rowKey===n));var s,n});try{await H.mutationQueue.retryNow()}catch{}if(e){const e=Q.useTempSaves.getState();for(const t of Object.values(e.notSaved)){const s=vs().find(e=>e.spec.table===t.table);!s||s.unsavedKeys().includes(t.id)||H.mutationQueue.hasPending(t.table,a,t.id)||e.clear((0,Q.tempKey)(t.table,t.id))}}return null}H.mutationQueue.onFailed(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().mark({id:e.rowKey,table:e.table,why:(0,$.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused')})}),H.mutationQueue.onDone(e=>{Ss.includes(e.table)&&Q.useTempSaves.getState().clear((0,Q.tempKey)(e.table,e.rowKey))});let bs=null;const Is=(e=3e3)=>{bs&&clearTimeout(bs),bs=setTimeout(()=>{bs=null,ks(!1)},e)};(0,M.onConnectivity)(e=>{e&&Is()}),Ee.subscribe((e,t)=>{('live'===e.mode&&'live'!==t.mode||e.perms!==t.perms&&Pe('device.write')&&!t.perms.includes('device.write')&&!t.perms.includes('*'))&&Is(3500)});const Rs='golive:v1:';async function Os(e){'live'!==z.useStore.getState().clock.mode&&z.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)?await Ts(e):(await L.kv.get(Rs+e,!1)||await Ts(e),await L.kv.get(Ds+e,!1)||(Us(e),await L.kv.set(Ds+e,!0)),await L.kv.get(As+e,!1)||(Cs(),await L.kv.set(As+e,!0)))}const As='golive:v3:';function Cs(){const e=e=>JSON.stringify(e).includes('(example)');try{de.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 Ds='golive:v2:';function Us(e){const t=e=>JSON.stringify(e).includes('(example)');z.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)))})),ce.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 Ts(e){if(g.LIVE_VENUE_BUILD&&(0,g.isLiveVenue)(e)){const t=(0,m.stripCoreLiveSamples)(z.useStore.getState()),a=(0,de.stripKitchenExamples)(de.useKitchen.getState()),s=ce.useOwner.getState(),n=(0,m.stripOwnerLiveSamples)(s),i={accidents:ue.useSafety.getState().accidents.filter(e=>!(0,ue.isSeedAccident)(e))},r=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));r(z.useStore.getState(),t)&&(await(0,_.archiveChefCache)('core',z.useStore.getState()),z.useStore.setState(t)),r(de.useKitchen.getState(),a)&&(await(0,_.archiveChefCache)('kitchen',de.useKitchen.getState()),de.useKitchen.setState(a)),r(s,n)&&(await(0,_.archiveChefCache)('owner',s),ce.useOwner.setState(n)),r(ue.useSafety.getState(),i)&&(await(0,_.archiveChefCache)('safety',ue.useSafety.getState()),ue.useSafety.setState(i));const o=(0,U.stripHrSamples)(U.useHr.getState());r(U.useHr.getState(),o)&&(await(0,_.archiveChefCache)('hr',U.useHr.getState()),U.useHr.setState(o));const d=(0,y.stripGpSamples)(y.useGpCalc.getState());r(y.useGpCalc.getState(),d)&&(await(0,_.archiveChefCache)('gp',y.useGpCalc.getState()),y.useGpCalc.setState(d));const u=ie.useOrderSheets.getState(),c={sheets:{...u.sheets,anchorage:(u.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};r(u,c)&&(await(0,_.archiveChefCache)('order-sheets',u),ie.useOrderSheets.setState(c));const l=ne.useCardStore.getState(),f={cards:l.cards.filter(e=>!(0,g.isLiveVenue)(e.restaurantId)||!(0,w.isDemoCard)(e)),log:l.log.filter(e=>!(0,w.demoActor)(e.by))};return r(l,f)&&(await(0,_.archiveChefCache)('recipe-cards',l),ne.useCardStore.setState(f)),void await L.kv.set(Rs+e,!0)}const t=t=>t.restaurantId===e&&!(0,le.isUuid)(t.id);z.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)))})),te.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,le.isUuid)(t.id))})),ae.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),ce.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,le.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,le.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,le.isUuid)(e.id)),leave:e.leave.filter(e=>(0,le.isUuid)(e.id)),swaps:[]}));try{de.useKitchen.setState(e=>(0,de.stripKitchenExamples)(e))}catch{}ce.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,le.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,le.isUuid)(e.id)&&(0,le.isUuid)(e.supplierId))}));try{ue.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 L.kv.set(Rs+e,!0)}const Es=(e,t)=>Qe({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function Ns(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(ae.useFloor.getState().live[e]??{}).map(([e,t])=>Es(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===Ee.getState().kind||Pe('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:(0,X.actorStamp)({isCar:Y.IS_CAR,kind:Ee.getState().kind,staffRef:Ee.getState().staffRef,fallback:Me})}),fromRow:e=>Es(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>ae.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=>ae.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function Ps(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(oe.useSetup.getState().sites[e]?.grades??oe.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:()=>Pe('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=oe.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}));oe.useSetup.getState().patch(e,{grades:i})},subscribe:t=>oe.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ks='staff-avatars',Ms=new Map;let xs=!1;const qs=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function js(){if(!xs){xs=!0;try{for(const[e,t]of Ms){const a=re.useAvatars.getState().photos[e];if(!t){a?.path&&re.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===Ee.getState().staffRef)continue;const{data:s,error:n}=await Te().storage.from(Ks).download(t);if(n||!s)continue;const i=await qs(s);i.startsWith('data:image/')&&re.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:i,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{xs=!1}}}function Ls(e){const t=async()=>{const t=Ee.getState().staffRef,a=t?ht.get(t)??Ee.getState().staffUuid:void 0;if(!t||!a||'staff'!==Ee.getState().kind)return;const s=re.useAvatars.getState().photos[t];try{const n=Ms.get(t),i=t=>{t&&t.startsWith(`${e}/${a}-`)&&Te().storage.from(Ks).remove([t]).catch(()=>{})};if(!s){const e=!!re.useAvatars.getState().clears?.[t];return e&&n&&(await Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}),Ms.set(t,null),i(n)),void(e&&re.useAvatars.getState().doneClear(t))}if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void Ne({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 Te().storage.from(Ks).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Ba('set_staff_avatar',{p_staff_ref:t,p_path:d}),Ms.set(t,d),n!==d&&i(n),re.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){Ne({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:re.useAvatars.getState().photos},s=re.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),Pe('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==Ee.getState().staffRef&&e.clears?.[t]){const e=s[t].path;Ms.set(t,null),re.useAvatars.getState().doneClear(t),Ba('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>Te().storage.from(Ks).remove([e])).catch(()=>{})}});return t(),s}const Bs=new Map,$s=(0,N.create)(()=>({n:0}))},899,[900,901,902,903,806,817,904,822,818,823,905,909,910,820,912,914,915,916,917,918,839,919,920,923,926,927,831,928,971,973,974,975,978,972,979,977,984,976,985,986,987,989,992,988,816,856,993,805,995,998,895,868,1000,885,886,1002,1003,876,854,1005,1008,1010,1011,1012,880,1013,1014,1015,1016,1017,1018,891,893,869,847,842,1019,1022,1023]); __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PAY_WINDOW_MINS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ALLERGEN_LINE",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"allergyPhoneLine",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useTakeawayMenu",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"takesCardTakeaway",{enumerable:!0,get:function(){return s}}),e.takeawayAvail=function(t,n){return t.hidden||!t.signOff||null==t.price||t.price<=0?'off':n&&n.on.includes(t.id)?t.soldOut||n.soldOut.includes(t.id)?'sold-out':'on':'off'},Object.defineProperty(e,"NOT_TODAY_LABEL",{enumerable:!0,get:function(){return f}}),e.takeawayNotToday=function(t,n){return!!n&&!t.hidden&&!!t.signOff&&null!=t.price&&t.price>0&&!n.on.includes(t.id)},e.payView=function(t,n){if('takeaway'!==t.type)return{kind:'none'};const r=t.payment;if('refused'===r?.state)return{kind:'refused',reason:r.error||'The restaurant could not take this order.'};if('paid'===r?.state)return{kind:'paid',amount:r.paidPence??t.paid,late:!!r.late};if('expired'===r?.state||'cancelled'===t.status&&'waiting'===r?.state)return{kind:'expired'};if('awaiting_payment'!==t.status)return{kind:'none'};if(!r?.expiresAt)return{kind:'sending'};const o=Math.floor((Date.parse(r.expiresAt)-n)/1e3);return o>0?{kind:'pay',secondsLeft:o,expiresAt:r.expiresAt}:{kind:'expired'}},Object.defineProperty(e,"mmss",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"paidBadge",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);const n=15,r='All our products are made with ingredients that contain allergens. Please speak to a member of our team before ordering if you have any questions.',o=t=>t?`If you have an allergy, phone us on ${t} before ordering.`:'If you have an allergy, phone the restaurant before ordering.',u=(0,t.create)(t=>({byVenue:{},set:(n,r)=>t(t=>({byVenue:{...t.byVenue,[n]:r}}))})),s=(t,n)=>!!t&&!t.fictional&&!n;const f='Not available for takeaway today';const l=t=>`${Math.floor(Math.max(0,t)/60)}:${String(Math.max(0,t)%60).padStart(2,'0')}`,c=t=>'paid'===t.payment?.state?`Paid by card online \xb7 \xa3${((t.payment.paidPence??t.paid)/100).toFixed(2)}${t.payment.late?' (paid late: check the slot)':''}`:null},900,[831]); __d(function(g,r,_i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UK14",{enumerable:!0,get:function(){return t}}),e.cardAllergenMap=n,e.applyServerCard=function(t,s){const i=s.updated_at?new Date(String(s.updated_at)).toISOString():t.updatedAt,o=s.doc?.item?.allergenNotes;return{...t,allergens:n(s.allergens,s.may_contain),allergenNotes:'string'==typeof o&&o?o:void 0,dish:'string'==typeof s.dish&&s.dish?s.dish:t.dish,section:'string'==typeof s.section&&s.section?s.section:t.section,price:'number'==typeof s.price_pence?s.price_pence:t.price,signOff:t.signOff??{by:'Head chef',at:i}}},e.serverItem=function(t,s){const i=t.doc?.item;return i&&i.id?{...i,restaurantId:s,allergens:n(t.allergens,t.may_contain)}:null},Object.defineProperty(e,"noAllergenWords",{enumerable:!0,get:function(){return s}});const t=['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'];function n(n,s){const i=n=>Array.isArray(n)?n.map(String).filter(n=>t.includes(n)):[],o={};for(const t of i(s))o[t]='may';for(const t of i(n))o[t]='contains';return o}const s=t=>t?'No listed allergens':'Allergens not confirmed yet: ask staff'},901,[]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isKitchenTeam",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canEditKitchenRota",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"kitchenTeam",{enumerable:!0,get:function(){return c}}),e.kitchenPending=function(t,n,c,s){return t.filter(t=>n.has(t.staffId)&&!!t.date&&t.date>=c&&t.date<=s&&(!t.published||t.changed))},e.publishKitchen=function(t,n,c,s){let u=0;return{shifts:t.map(t=>!n.has(t.staffId)||!t.date||t.dates||t.published&&!t.changed?t:(u++,{...t,published:!0,changed:!1})),n:u}},Object.defineProperty(e,"clashes",{enumerable:!0,get:function(){return s}});const t=t=>'kitchen'===String(t.dept??'').trim().toLowerCase()&&'owner'!==t.role&&'manager'!==t.role&&!t.managerAccess&&!t.ownerAccess,n=t=>t.includes('*')||t.includes('rota.kitchen')||t.includes('rota.manage'),c=n=>n.filter(n=>!1!==n.active&&t(n));const s=(t,n,c,s,u,o)=>t.some(t=>t.staffId===n&&t.date===c&&t.id!==o&&t.start{const t=()=>c(t=>t+1);u.add(t);const o=n.mutationQueue.subscribe(t);return()=>{u.delete(t),o()}},[]),l(o)};var t=r(d[0]),n=r(d[1]);const o=new Map,u=new Set,c=()=>{for(const t of u)t()};let s=()=>!1;function l(t){if(!t)return!1;return n.mutationQueue.pending.some(n=>'attendance'===n.table&&n.rowKey===t)||o.has(t)&&s()}n.mutationQueue.onDone(t=>{'attendance'===t.table&&o.delete(t.rowKey)&&c()})},975,[17,976]); __d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const n='queue:v1',r='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class l{items=[];failedItems=[];loaded=null;flushing=null;flushingSince=0;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(n,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(r,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(n=>n.table===t&&n.venueId===e&&n.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const n=h(s);if(!t.has(n)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(n)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){if(this.flushing&&Date.now()-this.flushingSince<6e4)return this.flushing;this.flushingSince=Date.now();let e=null;return e=(async()=>{for(await this.load();this.exec;){if(this.flushing&&this.flushing!==e)return;const n=this.nextReady();if(!n)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(n);this.remove(n),this.backoffMs=2e3,'conflict'===t?this.fail(n,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(n))}catch(e){n.attempts+=1,n.lastError=String(e?.message??e);const r=e??{};n.lastErr={code:r.code?String(r.code):void 0,status:Number(r.status)||void 0,message:n.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(e);if('network'===h){n.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?n.nextAt=this.now()+(0,s.retryDelayMs)(n.attempts):(this.remove(n),this.fail(n,'rejected',n.lastError))}await this.persist()}this.flushing===e&&(this.flushing=null),this.scheduleWaiting()})(),this.flushing=e,e}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(r,[]),this.emit()}fail(t,s,n){const h={...t,lastError:n,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(r,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(n,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const o=new l},976,[973,972,977]); __d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'clock correction request',staff_leave:'time off',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},977,[973]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.211'},978,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.212'},978,[]); __d(function(g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return d}}),e.executeMutation=async function(t){const n=(t,n)=>{throw Object.assign(t,{status:n})};if('rpc'===t.kind){const{error:r,status:s}=await l().rpc(t.fn,t.values??{});return r&&n(r,s),'ok'}const r=l().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:s,status:o}=await r.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});if(s&&'stock_events'===t.table&&'23503'===s.code&&/undoes/i.test(String(s.message??''))&&t.values?.undoes){t.values={...t.values,undoes:null};const s=await r.upsert(t.values,{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return s.error&&n(s.error,s.status),'ok'}return s&&await h(t,(0,c.resolveUniqueConflict)(t,s))||s&&n(s,o),'ok'}let s='update'===t.kind?r.update(t.values??{}):r.delete();for(const[n,r]of Object.entries(t.match??{}))s=s.eq(n,r);const{data:o,error:u,status:d}=await s.select();if(u&&await h(t,(0,c.resolveUniqueConflict)(t,u)))return'ok';u&&n(u,d);if('update'===t.kind&&(!o||0===o.length)){const n=(0,c.resolveMissingUpdate)(t);return'already-saved'===n.kind||'update-unversioned'===n.kind&&await h(t,n)?'ok':'conflict'}return'ok'};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),u=_r(_d[5]),c=_r(_d[6]);const l=()=>(0,r.getSupabase)();class d{constructor(t,n={}){this.table=t,this.opts=n,this.keyOf=n.keyOf??(t=>String(t.id)),this.keyColumns=n.keyColumns??['id'],this.venueCol=n.venueColumn??'venue_id'}rows(t){return n.cache.rows(this.table,t)}get(t,r){return n.cache.get(this.table,t,r)}subscribe(t,r){return n.cache.subscribe(this.table,t,r)}hydrate(t){return n.cache.hydrate(this.table,t)}async refresh(r,s={}){const o=()=>{let t=l().from(this.table).select('*').eq(this.venueCol,r);return this.opts.orderBy&&(t=t.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),s.filter&&(t=s.filter(t)),t},c='bookings'===this.table?await(0,t.readPages)(async(t,n)=>{const{data:r,error:s}=await o().order('id').range(t,n);if(s)throw s;return r??[]}):await(async()=>{const{data:t,error:n}=await o().limit(this.opts.limit??1e3);if(n)throw n;return t??[]})();return n.cache.replace(this.table,r,c.map(t=>[this.keyOf(t),t]),t=>u.mutationQueue.hasPending(this.table,r,t)),c}async create(t,r){const o={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,s.uuid)()}:{},...r,[this.venueCol]:t},c=this.keyOf(o);return n.cache.put(this.table,t,c,o),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:o,conflictKey:this.opts.conflictKey??'id'}),o}async update(t,r,s,o={}){const c=n.cache.get(this.table,t,r),l={...this.matchFor(r,c),...o,[this.venueCol]:t};n.cache.patch(this.table,t,r,{...s,updated_at:(new Date).toISOString()}),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'update',rowKey:r,values:s,match:l})}async remove(t,r){const s=n.cache.get(this.table,t,r),o={...this.matchFor(r,s),[this.venueCol]:t};n.cache.remove(this.table,t,r),await u.mutationQueue.enqueue({table:this.table,venueId:t,kind:'delete',rowKey:r,match:o})}matchFor(t,n){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const r={};for(const t of this.keyColumns)r[t]=n?.[t];return r}}async function h(t,n){if('already-saved'===n.kind)return!0;if('unresolved'===n.kind)return!1;if('merge'===n.kind&&'name-ci'===n.lookup){const r=String(n.match.venue_id??t.venueId??'');if(!r)return!1;const{data:s,error:u}=await l().from(n.table).select('id,name,deleted_at').eq('venue_id',r).is('deleted_at',null);if(u||!s)return!1;const c=(0,o.findSavedPlanByName)(s,String(n.match.name??''));if(!c)return!1;return!(await l().from(n.table).update(n.patch).eq('id',c.id).is('deleted_at',null)).error}if('merge'===n.kind||'update-unversioned'===n.kind){let r=l().from('merge'===n.kind?n.table:t.table).update(n.patch);for(const[t,s]of Object.entries(n.match))r=r.eq(t,s);const s=await r.select();return!s.error&&!!s.data?.length}return!1}},979,[980,981,928,972,982,976,983]); __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readPages=async function(t,n=1e3){const s=[];for(let c=0;;c+=n){const o=await t(c,c+n-1);if(s.push(...o),o.length`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},981,[972]); @@ -1413,8 +1413,8 @@ __d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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."})})}},1330,[13,17,777,1331,1154,1255,8]); __d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,m]=(0,l.useState)(null),[x,y]=(0,l.useState)(null),[j,f]=(0,l.useState)([]),[k,w]=(0,l.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,l.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,O]=(0,l.useState)(''),[P,R]=(0,l.useState)(''),[I,M]=(0,l.useState)(''),[L,N]=(0,l.useState)(!1),[$,A]=(0,l.useState)(null),[B,D]=(0,l.useState)([]),q=(0,l.useCallback)(async()=>{try{m(await(0,c.tablePublic)(e)),y(null)}catch(e){y((0,d.tableOrderError)(e,'menu'))}},[e]),_=(0,l.useCallback)(async()=>{try{D(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,l.useEffect)(()=>{q(),_();const e=setInterval(()=>{_(),q()},8e3);return()=>clearInterval(e)},[q,_]);const W=s?.menu??[];(0,l.useEffect)(()=>{f(e=>e.filter(e=>W.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const E=(0,l.useMemo)(()=>{const e=new Map;for(const t of W)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,W),z='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],G=(0,d.allergyClashes)(j,W,z.map(e=>e.allergen)),V=e=>j.find(t=>t.id===e)?.qty??0,F=(e,t)=>f(n=>t<=0?n.filter(t=>t.id!==e):n.some(t=>t.id===e)?n.map(n=>n.id===e?{...n,qty:t}:n):[...n,{id:e,qty:t,note:''}]),H=(e,t)=>f(n=>n.map(n=>n.id===e?{...n,note:t}:n)),J=async()=>{N(!0),A(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:I,name:v,phone:P,allergies:z});f([]),M(''),A({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),_()}catch(e){A({kind:'warn',text:(0,d.tableOrderError)(e,'send')}),q()}finally{N(!1)}};if(x)return(0,p.jsxs)(o.Screen,{title:"Order at the table",children:[(0,p.jsx)(o.Banner,{kind:"warn",title:"Couldn't open the menu",children:x}),(0,p.jsx)(o.Button,{label:"Try again",onPress:()=>{q()}})]});if(!s)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,p.jsx)(o.Screen,{title:"Order at the table",children:(0,p.jsx)(o.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const K=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&(0,d.nameOk)(v)&&(0,d.phoneOk)(P)&&!L,Q=s.askServer??[],U=[...new Set(Q.map(e=>e.section))],X=L?'Sending\u2026':j.length?null===k?'Answer the allergy question':(0,d.nameOk)(v)?(0,d.phoneOk)(P)?`Send order to the kitchen (${(0,i.gbp)(Y)})`:'Check the phone number':'Add your name to send':'Add a dish to order';return(0,p.jsxs)(o.Screen,{title:`Table ${(0,n.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,p.jsx)(o.Button,{label:X,disabled:!K,onPress:()=>{J()},testID:"send-table-order-live"}):void 0,children:[(0,p.jsxs)(o.Muted,{center:!0,children:["Tip: add dishes, answer the allergy question, add your name, then send. Staff bring it to table ",(0,n.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,p.jsx)(o.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,p.jsx)(o.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!B.some(e=>e.accepted)?(0,p.jsx)(o.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,$?(0,p.jsx)(o.Banner,{kind:$.kind,children:$.text}):null,B.length?(0,p.jsx)(r.default,{testID:"my-table-orders",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Your orders at this table"}),B.map(e=>(0,p.jsxs)(r.default,{style:{gap:2,paddingVertical:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{children:e.ref}),(0,p.jsx)(o.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,p.jsxs)(o.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,i.gbp)(e.totalPence)," to pay at the bar or with the server"]})]},e.id))]})}):null,s.open?E.map(([e,t])=>(0,p.jsxs)(r.default,{style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,p.jsxs)(r.default,{style:{flex:1,gap:2},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),e.description?(0,p.jsx)(o.Muted,{children:e.description}):null,(0,p.jsxs)(o.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(a.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(a.allergenLabel).join(', ')}`:'']})]}),(0,p.jsx)(o.T,{weight:"semibold",colour:u.colours.gold,children:(0,i.gbp)(e.pricePence)})]}),e.soldOut?(0,p.jsx)(o.Badge,{kind:"amber",label:"Sold out today"}):V(e.id)?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:V(e.id),min:0,max:20,onChange:t=>F(e.id,t),label:e.name}),(0,p.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>F(e.id,0)})]}):(0,p.jsx)(o.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>F(e.id,1)})]},e.id))]},e)):null,s.open&&!W.length?(0,p.jsx)(o.Banner,{kind:"demo",title:"No dishes to order from your phone yet",children:"The kitchen is still checking the allergens on the menu. Please order with your server or at the bar."}):null,s.open&&Q.length?(0,p.jsxs)(r.default,{testID:"table-ask-server",style:{gap:8},children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:u.colours.gold,accessibilityRole:"header",children:W.length?'Also on the menu':'On the menu'}),(0,p.jsx)(o.Muted,{center:!0,children:"Ask your server for these. They can't be ordered from your phone yet, while the kitchen checks their allergens."}),U.map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:e}),Q.filter(t=>t.section===e).map((e,t)=>(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{style:{flex:1},children:e.name}),(0,p.jsx)(o.T,{colour:u.colours.muted,children:(0,i.gbp)(e.pricePence)})]},`${e.name}-${t}`))]},e))]}):null,s.open&&j.length?(0,p.jsx)(r.default,{testID:"table-cart",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Review your order"}),j.map(e=>{const n=W.find(t=>t.id===e.id);return(0,p.jsxs)(r.default,{style:{gap:4},children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(o.T,{children:[e.qty,"\xd7 ",n?.name]}),(0,p.jsx)(o.T,{children:(0,i.gbp)(e.qty*(n?.pricePence??0))})]}),(0,p.jsx)(t.TextInput,{style:b,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${n?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Total"}),(0,p.jsx)(o.T,{weight:"semibold",children:(0,i.gbp)(Y)})]})]})}):null,s.open?(0,p.jsx)(r.default,{testID:"table-allergy",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,p.jsx)(o.Muted,{center:!0,children:"We ask everyone, so the kitchen can keep you safe."}),(0,p.jsxs)(o.Row,{gap:8,style:{justifyContent:'center'},children:[(0,p.jsx)(o.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,p.jsx)(o.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:a.ALLERGENS.map(e=>(0,p.jsx)(o.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,G.length?(0,p.jsxs)(o.Banner,{kind:"warn",title:"Check with staff",children:[G.map(e=>e.name).join(', ')," ",G.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Who's the order for?"}),(0,p.jsx)(t.TextInput,{style:b,value:v,onChangeText:O,placeholder:"Your name (needed)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your name, needed",testID:"table-name",autoComplete:"name"}),(0,p.jsx)(t.TextInput,{style:b,value:P,onChangeText:R,placeholder:"Phone number (optional)",placeholderTextColor:u.colours.muted,maxLength:20,keyboardType:"phone-pad",accessibilityLabel:"Phone number, optional",testID:"table-phone",autoComplete:"tel"}),P&&!(0,d.phoneOk)(P)?(0,p.jsx)(o.Muted,{center:!0,children:"Please check the phone number, or leave it blank."}):null,(0,p.jsx)(o.Muted,{center:!0,children:"We only use these for this order."}),(0,p.jsx)(t.TextInput,{style:b,value:I,onChangeText:M,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,p.jsx)(r.default,{testID:"pay-placeholder",children:(0,p.jsxs)(o.Card,{children:[(0,p.jsx)(o.T,{center:!0,weight:"semibold",children:"Paying"}),(0,p.jsx)(o.T,{center:!0,children:d.PAY_WORDS}),(0,p.jsx)(o.Muted,{center:!0,children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),n=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),r=(e=s)&&e.__esModule?e:{default:e},o=_r(_d[4]),a=_r(_d[5]),i=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]);const b={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},1331,[812,843,17,85,777,845,851,1154,1332,858,804,8]); __d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const o=await(0,n.rpc)('guest_table_order_v2',{p_phone:(a.phone??'').trim().slice(0,20)||null,p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null});if(!o||!1===o.ok||!o.id)throw new Error(o?.reason||'This table code isn\u2019t working any more. Please ask a member of staff.');return{id:o.id,ref:o.ref,held:!!o.held,totalPence:o.totalPence}},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"tableReadiness",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return u}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=()=>(0,n.rpc)('table_order_readiness',{p_venue:o()}),c=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),u=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},1332,[928,899,1154]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1333,[13,17,856,1334,1406,8]); -__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Xe}}),_e2.DisplayBoard=function(e={}){const t=(0,ne.useOwner)(e=>e.site);return(0,se.useRestaurant)(t)?(0,Ye.jsx)(rt,{...e}):(0,Ye.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:le.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Ye.jsx)(Q.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]);const Qe='#221C12',Je='#2E2618',Xe=12e4,Ze={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},et={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},tt={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},st=e=>(e??'').replace(' (example)',''),lt=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),it=e=>e.slotTime?(0,te.hm)(new Date(e.slotTime)):'ASAP';function nt({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Ye.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Ye.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Ye.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Ye.jsx)(Q.T,{size:s?24:19,weight:"semibold",colour:e.alert?le.colours.amber:le.colours.text,children:e.value}),(0,Ye.jsx)(Q.T,{size:s?14:12,colour:le.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Ye.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Ye.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Ye.jsx)(Q.T,{size:14,colour:le.colours.muted,children:"No Covers yet"}):(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",colour:le.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Ye.jsx)(Q.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Ye.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:le.colours.gold},children:[(0,Ye.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:le.colours.gold}}),(0,Ye.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function ot({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Ye.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Ye.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Ye.jsx)(Q.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?le.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Ye.jsx)(Q.T,{size:12,colour:le.colours.muted,children:s}):null]})}function at({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ue.statusBlock)(e,t,(0,Ue.linkedBooking)(e,l));return e.length?(0,Ye.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Ye.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:le.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?le.colours.ok:e.allergies.length?le.colours.red:le.colours.gold},children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:s?16:18,weight:"bold",children:[it(e)," \xb7 ",st(e.customerName)]}),(0,Ye.jsx)(Q.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Ye.jsxs)(Q.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,ee.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Ye.jsx)(Ve.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Ye.jsxs)(Q.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Ye.jsx)(Q.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>se.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Ye.jsx)(Q.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Ye.jsx)(Q.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>se.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Ye.jsx)(Te.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Ye.jsx)(Q.Muted,{children:"No takeaway orders right now."})}function rt({embedded:e=!1,boardW:b,headerExtra:ee,subHeader:Ve,noVoice:Ue=!1}={}){const it=(0,q.default)(),rt=b??it.width,ct=it.height,ut=rt<700,ht=rt>=ct,gt=!ut&&ht&&rt>=600,bt=gt,yt=Math.round(Math.min(520,Math.max(rt>=1e3?448:280,.3*rt))),pt=P.default.useRef(null),ft=P.default.useRef(0),[xt,mt]=(0,H.useState)({w:0,h:0}),jt=(0,ne.useOwner)(e=>e.site),wt=(0,se.useRestaurant)(jt);(0,$e.useAlertWatcher)(jt,{enabled:!e});const It=(0,se.useOrders)(jt),kt=(0,se.useBookings)(jt),Dt=(0,se.useEvents)(jt),vt=(0,se.useStore)(e=>e.skipMinutes),St=(0,se.useStore)(e=>e.clock.mode),Ct=(0,se.useNow)(5e3),Tt=(0,ne.useOwner)(e=>e.staff),Rt=(0,ne.useOwner)(e=>e.attendance),$t=(0,ne.useOwner)(e=>e.shifts),Bt=(0,ne.useOwner)(e=>e.leave),Wt=P.default.useMemo(()=>(0,Ne.workingShifts)($t,Bt),[$t,Bt]);P.default.useEffect(()=>{(0,ae.ensureAttendance)((0,te.ymd)(Ct),Ct)},[(0,te.ymd)(Ct)]);const Lt=(0,R.useSession)(e=>e.meId),zt=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:st(Tt.find(e=>e.id===Lt)?.name)}),Ht=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Ht,!0);const Pt=(0,te.ymd)(Ct),Mt=(0,A.useTravelDay)('display',Pt),At=(0,oe.useFrontDoor)(Pt,ht),Ot=(0,re.useDisplaySettings)(jt),Et=Ot.privacy,Nt=(0,fe.useSaverSync)(),_t=(0,re.usePlan)(jt),Gt=(0,re.useFloor)(e=>e.live[jt]),Ft=(0,Be.useBlocks)(e=>e.blocks),[Vt,Ut]=(0,H.useState)('plan'),[Kt,qt]=(0,H.useState)(!1),[Yt,Qt]=(0,H.useState)('all'),[Jt,Xt]=(0,H.useState)(null),[Zt,es]=(0,H.useState)(null),[ts,ss]=(0,H.useState)(null),[ls,is]=(0,H.useState)(!1),[ns,os]=(0,H.useState)(!1),[as,rs]=(0,H.useState)(null),[ds,cs]=(0,H.useState)(!1),[us,hs]=(0,H.useState)(!1),[gs,bs]=(0,H.useState)(!1),[ys,ps]=(0,H.useState)(!1),[fs,xs]=(0,H.useState)(null),[ms,js]=(0,H.useState)(null),[ws,Is]=(0,H.useState)(null),[ks,Ds]=(0,H.useState)(!1),vs=P.default.useRef(0),Ss=e=>{vs.current=Date.now(),Is(e)};P.default.useEffect(()=>{if(!ws)return;const e=setInterval(()=>{Date.now()-vs.current>=He.DAY_IDLE_MS&&Is(null)},5e3);return()=>clearInterval(e)},[ws]);const Cs=(0,se.useWaitlist)(jt),Ts=(0,se.useStore)(e=>e.walkIns[jt]??0),[Rs,$s]=(0,H.useState)(!1),[Bs,Ws]=(0,H.useState)(!1),[Ls,zs]=(0,H.useState)(!1),[Hs,Ps]=(0,H.useState)(!1);(0,X.useReviewAlerts)(jt);const[Ms,As]=(0,H.useState)({view:0,content:0}),[Os,Es]=(0,H.useState)(null);P.default.useEffect(()=>{Os&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Os,timeoutMs:4500,big:!0,testID:'floor-toast'}),Es(null))},[Os]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[Ns,_s]=(0,H.useState)(null),Gs=P.default.useRef(0),[Fs,Vs]=(0,H.useState)(null);P.default.useEffect(()=>{if(!Ns)return;Gs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Gs.current;if(e>=Xe)return _s(null),void Es('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Vs(e>=105e3?Math.ceil((Xe-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ns]);const Us=e=>e.date!==Pt?ss({title:`Guest details \xb7 ${(0,He.dayWord)(e.date,Pt)} ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[!e.walkIn&&e.date>Pt?(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,He.dayWord)(e.date,Pt)}, ${e.time}`,disabled:!Ii.ok,accessibilityHint:Ii.hint,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}):null,(0,Se.bookingDetails)(e)]})}):ss({title:`Guest details \xb7 ${e.time}`,body:(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(dt,{rid:jt,id:e.id,turnBase:wt.settings.turnMins}),e.walkIn?null:(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ss(null),rs(e.id)},style:{minHeight:56}}),e.walkIn?(0,Ye.jsx)(Ie.CancelWalkInButton,{rid:jt,b:e,big:!0,onDone:e=>{ss(null),Es(e)}}):null,e.walkIn?(0,Ye.jsx)(Ie.ReinstateWalkInButton,{rid:jt,b:e,today:Pt,onDone:e=>{ss(null),Es(e)}}):null,(0,Se.bookingDetails)(e)]})}),Ks=kt.filter(e=>e.date===Pt).sort((e,t)=>e.time.localeCompare(t.time)),qs=Ks.filter(e=>!['cancelled','noshow'].includes(e.status)),Ys=It.filter(lt).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Qs=(0,H.useMemo)(()=>(0,c.forecastToday)(wt,kt,It,Dt,Ct),[wt,kt,It,Dt,Ct.getTime()/6e4|0]),Js=(0,Be.closedAreasAt)(Ft,jt,Pt,(0,te.hm)(Ct)),Xs=[...Js].join(','),Zs=(0,H.useMemo)(()=>(0,de.floorView)(_t,kt,It,Gt??{},Ct,wt.settings.turnMins,Js),[_t,kt,It,Gt,Ct.getTime(),Xs]),el=(0,ve.hoursFor)(wt,Ct),tl=el?.open??new Date(`${Pt}T12:00:00`),sl=el?.close??new Date(`${Pt}T21:00:00`),ll=(0,te.addMins)(tl,-tl.getMinutes()),il=(0,te.addMins)(sl,30),nl=e=>new Date(`${Pt}T${e}:00`),ol=(0,Be.blocksOn)(Ft,jt,Pt).map(e=>({from:nl(e.from),to:nl(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(wt,Ct,Pt)),al=Object.keys(Zs).filter(e=>'blocked'===Zs[e]?.status),rl=ws&&ws!==Pt?ws:Pt,dl=rl!==Pt,cl=(0,He.dayWord)(rl,Pt),ul=/^(Today|Yesterday|Tomorrow)$/.test(cl),hl=dl?(0,He.bookingsForDay)(kt,rl,Pt).sort((e,t)=>e.time.localeCompare(t.time)):Ks,gl=(0,te.parseYmd)(rl);gl.setHours(12);const bl=dl?(0,ve.hoursFor)(wt,gl):el,yl=bl?.open??new Date(`${rl}T12:00:00`),pl=bl?.close??new Date(`${rl}T21:00:00`),fl=e=>new Date(`${rl}T${e}:00`),xl=[...dl?(0,Be.blocksOn)(Ft,jt,rl).map(e=>({from:fl(e.from),to:fl(e.to),label:e.reason??'Paused'})):ol,...dl?(0,n.queuedServicePauses)(wt,gl,rl):[]],ml=(0,n.queuedServiceSessions)(wt,gl),jl=l.IS_QUEUED_VENUE&&(void 0===ml||!ml.length),wl=(0,Ye.jsxs)(K.default,{testID:"queued-hours-gate",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:void 0===ml?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Ye.jsx)(Q.Muted,{children:i.queuedVenues[jt]?.hours.note})]}),Il=dl?bl||hl.length?rldl?(0,de.dayFloorView)(_t,hl,rl):Zs,[dl,_t,hl,rl,Zs]),[Dl,vl]=(0,H.useState)(null),[Sl,Cl]=(0,H.useState)(null),[Tl,Rl]=(0,H.useState)(!1),[$l,Bl]=(0,H.useState)(null),Wl=dl?hl.filter(e=>!['cancelled','noshow'].includes(e.status)):qs,Ll=Wl.reduce((e,t)=>e+t.partySize,0),zl=(0,u.coversSplit)(Wl,rl),Hl=(0,Me.cancelledDayTally)(kt,rl),Pl=(0,Ae.cancellationsFor)(kt,rl,e=>e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)','')),Ml=(0,Me.cancelledTallyWords)(Hl,ul?cl.toLowerCase():dl?`on ${cl}`:'today'),Al=Ft.filter(e=>e.rid===jt&&e.date===rl&&!e.removedAt),Ol=60*yl.getHours()+yl.getMinutes(),El=60*pl.getHours()+pl.getMinutes(),Nl=(0,ze.chartBands)(Al,Ol,El),_l=(0,ze.seasonClosedAreaIds)(Al,Ol,El),Gl=_l.size?{..._t,areas:_t.areas.filter(e=>!_l.has(e.id)),tables:_t.tables.filter(e=>!_l.has(e.areaId))}:_t,Fl=dl?[]:al.filter(e=>!_l.has(_t.tables.find(t=>t.name===e)?.areaId??'')),Vl=new Set((0,ze.blockedHours)(Nl)),Ul=Ct.getHours()+(Ct.getMinutes()>=30?1:0),Kl=Qs.hours.filter(e=>e.hour>=Ul&&!Vl.has(e.hour)),ql=Kl.reduce((e,t)=>e+t.coversHigh,0),Yl=Kl.reduce((e,t)=>e+t.coversLow,0),Ql=Math.round((Yl+ql)/2),Jl=!Qs.example&&Qs.open&&Qs.enough&&ql>0?`Usually ${(0,c.coversRange)(Ql,Ql)} more`:void 0,Xl=async(e,t)=>{const s=Zs[e]?.booking;if(!s||e===t)return;const l=Zs[t]?.status;if(l&&!['free','soon'].includes(l))return void Es('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${de.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,ke.guardBookingChange)(Es,{b:s,tables:[t]}))return;await se.repo.bookings.update(s.id,{table:t});const i=Gt?.[e]?.stage;re.useFloor.getState().setLive(jt,t,{stage:i??'seated',dirty:!1}),re.useFloor.getState().setLive(jt,e,{stage:void 0,dirty:!0}),Es(`Saving: ${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,ke.reportBookingSave)(s.id,`${(0,xe.privName)(s,Et)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,xe.privName)(s,Et)} to ${(0,d.tableNumbers)(t)}`,Es)},Zl=e=>{if(ms)return Cl(null),void js(t=>t?{...t,tables:(0,De.toggleTable)(t.tables,e)}:t);dl?vl(e):Zt?(e!==Zt&&Xl(Zt,e),es(null)):Xt(e)},ei=ms?kt.find(e=>e.id===ms.id):void 0,ti=ms&&ei?(()=>{const e=ei.walkIn?(0,xe.privName)(ei,Et):st(ei.name),t=(0,De.seatsOf)(_t,ms.tables).total,s=(0,De.seatLine)(t,ei.partySize),l=(0,De.pickClashes)(ei,ms.tables,kt.filter(e=>e.date===ei.date),wt.settings.turnMins),i=(0,De.tableKey)(ms.tables)!==(0,De.tableKey)((0,re.tablesOf)(ei.table));return(0,Ye.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:le.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,padding:10},children:[(0,Ye.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,He.dayWord)(ei.date,Pt)} ${ei.time}. Tap tables on the plan to add or take them off. ${(0,De.tablesWords)(ms.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",colour:le.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,He.dayWord)(ei.date,Pt)," ",ei.time]}),(0,Ye.jsxs)(Q.T,{size:16,colour:le.colours.text,children:[(0,De.tablesWords)(ms.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Sl?(0,Ye.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Sl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Sl})}):null,Tl&&ei&&ms.tables.length?(0,Ye.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,ms.tables.join('+')),onYes:()=>{Rl(!1),(async()=>{if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,s,e,t,Es)})()},onNo:()=>Rl(!1)}):null,(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:Sl?'plan-pick-overcap-yes':'plan-pick-save',label:Sl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Sl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,De.tablesWords)(ms.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ei)return void js(null);if(!(0,ke.guardBookingChange)(Es,{b:ei,tables:ms.tables}))return Cl(null),void js(null);const s=(0,De.overCapacityAsk)(ms.tables,t,ei.partySize);if(s&&!Sl)return void Cl(s);if('finished'===ei.status&&ms.tables.length&&!Tl)return void Rl(!0);Cl(null),Rl(!1);const l=ms.tables;js(null),await(0,ke.saveTablesReported)(jt,ei,l,e,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Cl(null),js(null)}})]})]})})():null,si=Gl.areas.filter(e=>Gl.tables.some(t=>t.areaId===e.id)),li=e=>{const t=_t.tables.filter(t=>t.areaId===e);return dl?`${t.filter(e=>!kl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Zs[e.name]?.status??'free')).length}/${t.length} free`},ii='all'===Yt||si.some(e=>e.id===Yt)?Yt:'all',ni=e=>(0,Ye.jsx)(ce.FloorCanvas,{plan:Gl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:gt,big:!0,view:kl,privacy:Et,turnBase:wt.settings.turnMins,highlight:ms?ms.tables:Zt?[Zt]:void 0,onTap:e=>Zl(e.name),onDrop:(e,t)=>ms||dl?void 0:Xl(e.name,t.name)}),oi=ut?1:ht||si.length>2?2:1,ai=e=>{const t=_t.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},ri=[];for(let e=0;e{const t=(0,ce.areaBounds)(_t,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ce.minReadableScale)(_t,e.id)}}),xt.w,xt.h):null,ci=e=>(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',height:ue.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:li(e.id)})]}),ui=(0,Ye.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-xt.w)>1||Math.abs(s-xt.h)>1)&&mt({w:t,h:s})},children:di?(0,Ye.jsx)(U.default,{style:{flex:1},scrollEnabled:di.scroll,showsVerticalScrollIndicator:di.scroll,contentContainerStyle:{gap:ue.GRID_GAP},children:di.rows.map((e,t)=>(0,Ye.jsx)(K.default,{style:{height:di.rowHeights[t],flexDirection:'row',gap:ue.GRID_GAP},children:e.map(e=>{const t=si.find(t=>t.id===e);return(0,Ye.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:di.cellW,gap:2},children:[ci(t),(0,Ye.jsx)(K.default,{style:{flex:1},children:ni(e)})]},e)})},t))}):null}),hi=(0,Ye.jsxs)(K.default,{testID:"venue-plan",style:{flex:ut?void 0:1,gap:10,minWidth:0},children:[(0,Ye.jsx)(r.TableNumberWarning,{plan:_t}),_t.tables.length?null:(0,Ye.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Ye.jsx)(Q.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Ye.jsx)(Q.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Ye.jsx)(Q.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Ye.jsx)(ot,{chipId:"all",compact:!ut,label:"Whole venue",selected:'all'===ii,onPress:()=>Qt('all')},"__all"),...si.map(e=>(0,Ye.jsx)(ot,{chipId:e.id,compact:!ut,label:`${e.name}${(0,he.areaMarks)(e)}`,colour:(0,le.brandColour)(e.colour),sub:ut?Js.has(e.id)?'closed':ii===e.id?li(e.id):void 0:void 0,selected:ii===e.id,onPress:()=>Qt(e.id)},e.id))];return ut?(0,Ye.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Ye.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;As(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>As(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:Ms.view>0&&Ms.content>0&&Ms.content<=Ms.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:Ms.view>0&&Ms.content<=Ms.view+1?'100%':void 0},children:e})})(),(0,Ye.jsx)(g.FloorLegend,{}),ti,Zt?(0,Ye.jsxs)(Q.Row,{gap:8,style:{backgroundColor:le.colours.goldTint,borderRadius:10,padding:8},children:[(0,Ye.jsxs)(Q.T,{weight:"semibold",colour:le.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(Zt),": tap the new table."]}),(0,Ye.jsx)(Q.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>es(null)})]}):null,'all'===ii&>?ui:'all'===ii?(0,Ye.jsx)(K.default,{style:{flex:ut?void 0:1,gap:12,minHeight:bt?void 0:360},children:ri.map((e,t)=>(0,Ye.jsxs)(K.default,{style:{flex:ut?void 0:Math.max(.3,...e.map(e=>ai(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Ye.jsxs)(K.default,{style:{flex:1,gap:2},children:[ut?(0,Ye.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Ye.jsxs)(Q.T,{center:!0,size:18,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{center:!0,size:14,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{center:!0,children:li(e.id)})]}):(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between'},children:[(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:(0,le.brandColour)(e.colour),children:[e.name,(0,he.areaMarks)(e)]}),Js.has(e.id)?(0,Ye.jsx)(Q.T,{size:13,weight:"semibold",colour:le.colours.blue,children:"Closed for weather"}):(0,Ye.jsx)(Q.Muted,{children:li(e.id)})]}),(0,Ye.jsx)(K.default,{style:ut?{height:Math.max(280,Math.round((rt-40)*ai(e.id)))}:{flex:1},children:ni(e.id)})]},e.id)),e.length{if(dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},rl)}),bi='timeline'===Vt,yi=Kt?(0,Ye.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>qt(!1),supportedOrientations:['landscape','portrait'],children:(0,Ye.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:le.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Ye.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>qt(!1),style:{minHeight:64,minWidth:rt<600?120:180,paddingHorizontal:rt<600?14:22,borderRadius:16,borderWidth:2,borderColor:le.colours.goldLight,backgroundColor:le.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Ye.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Ye.jsx)(Q.T,{size:22,weight:"semibold",colour:le.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${dl?(0,He.dayLong)(rl):'Today'}`})}),rt<600?null:(0,Ye.jsx)(K.default,{style:{minWidth:180}})]}),jl?wl:(0,Ye.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Ye.jsx)(ye.Timeline,{isToday:!dl,fit:!0,plan:Gl,bookings:dl?hl:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,t0:dl?(0,te.addMins)(yl,-yl.getMinutes()):ll,t1:dl?(0,te.addMins)(pl,30):il,pauses:dl?xl:ol,blockedTables:Fl,onOpen:e=>{if(qt(!1),dl)return void xs(e.id);const t=(0,re.tablesOf)(e.table)[0];t&&Zs[t]?Xt(t):Us(e)}},`full-${rl}`)})]})}):null,pi=dl?(0,Ye.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:le.colours.gold,backgroundColor:le.colours.goldTint},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:ul?`Showing ${cl} \xb7 ${(0,te.niceDate)((0,te.parseYmd)(rl))}`:`Showing ${(0,He.dayWord)(rl,Pt)}`}),(0,Ye.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Ml}. Showing ${(0,He.dayLong)(rl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Ye.jsx)(Q.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{js(null),Ss(null)},style:{minHeight:44}})]}):null,fi=(0,Ye.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ut?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(bi||Kt);return(0,Ye.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Ut('plan'),qt(!0)):(qt(!1),Ut('plan'))},style:{flex:ut?1:void 0,minHeight:ut?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?le.colours.gold:'transparent',..._e.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Ye.jsx)(Q.T,{size:ut?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),xi='display'===k.APP_VARIANT&&!e,mi='display'===k.APP_VARIANT&&!e,ji=!e&&!k.IS_CAR&&!ut,wi=xi?(0,Ye.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ut?'column':'row',flexWrap:ut||ji?'nowrap':'wrap',gap:6,alignItems:ut||ji?'stretch':'center'},children:[fi,(0,Ye.jsx)(I.DisplayRotaKitchenButtons,{phone:ut,fill:ji,shifts:$t,staff:Tt,today:Pt,leave:Bt})]}):fi,Ii=(0,h.useBookingWrite)(),ki=e=>(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Walk-in",onPress:At.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"New booking",onPress:At.openBooking,testID:"add-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint}),(0,Ye.jsx)(Ge.BigAction,{premium:!0,label:"Edit booking",onPress:()=>os(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!Ii.ok,accessibilityHint:Ii.hint})]});(0,qe.useDisplayNotices)(jt,!e);const Di=!e&&!k.IS_CAR&&!ut,vi=ut?180:202,[Si,Ci]=(0,H.useState)(ut?180:168),Ti=P.default.useRef(ut?180:168),Ri=P.default.useRef(null),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(!1),[Li,zi]=(0,H.useState)(!1),Hi=!ut&&ct<=800,Pi=Le.DAY_GRAPH_CHROME+(Hi?24:8),Mi=P.default.useRef(0),[Ai,Oi]=(0,H.useState)(Pi),[Ei,Ni]=(0,H.useState)(!0),Gi=`${it.width}x${ct}`,[Fi,Vi]=(0,H.useState)(null),Ui=Fi===Gi,Ki=P.default.useRef(null),qi=P.default.useRef(0),Yi=P.default.useRef(()=>{}),Qi=P.default.useCallback(e=>{Math.abs(e-Mi.current)>=2&&(Mi.current=e,setTimeout(()=>Yi.current(),0))},[]),Ji=()=>{const e=Ri.current,t=$i.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==it.width||n.height!==ct)&&qi.current<5)return qi.current+=1,void setTimeout(()=>Yi.current(),450);qi.current=0;const o=t>Ti.current?Math.ceil(t-Ti.current):0,a=Di?Math.max(Pi,Mi.current):Math.max(Pi,o);Di&&a!==Ai&&Oi(a);const r=!ut&&ct>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(Di&&c!==Ei&&Ni(c),Di&&!Ui)if(d<48){const e=Ki.current,t=Date.now();e&&e.key===Gi&&t-e.at>=300?(Ki.current=null,Vi(Gi)):(e&&e.key===Gi||(Ki.current={key:Gi,at:t}),setTimeout(()=>Yi.current(),450))}else Ki.current=null;const u=d-(c?i:0),h=Math.min(vi,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ti.current-h)>=2&&(Ti.current=h,Ci(h))},l=44+(ct<820?4:8),i=46+(ct<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Bi.current;Di&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ct<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Wi.current?44+d:0)}):s(n,a,t,Di?i:l)})})};Yi.current=Ji,P.default.useEffect(()=>{const e=setTimeout(()=>Yi.current(),60),t=setTimeout(()=>Yi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[rt,ct,rl]);const Xi=(0,Ye.jsxs)(K.default,{ref:$i,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Ji()},style:{flexDirection:'row',flexWrap:rt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ut?12:Hi?2:6,justifyContent:ut?'center':void 0,borderTopWidth:1,borderTopColor:le.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Ye.jsx)(Ke.DisplayClockButton,{}),(0,Ye.jsx)(be.HoldToEdit,{quiet:!0,onUnlock:()=>{Vs(null),_s({at:Date.now()})},onHint:()=>Es('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Ye.jsx)(We.BlockBookingsButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,display:!0,day:rl}),_t.areas.some(e=>e.outdoor)?(0,Ye.jsx)(We.CloseGardenButton,{rid:jt,r:wt,now:Ct,by:zt,quiet:!0,short:!0}):null,(0,Ye.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ps(!0),style:({pressed:e})=>({..._e.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",colour:le.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Ye.jsx)(f.GiftQrButton,{rid:jt,venue:wt.name})]}),Zi=Ys.length?(0,Ye.jsxs)(K.default,{testID:"takeaway-panel",style:[_e.look.panel,{overflow:'hidden'}],children:[(0,Ye.jsxs)(Q.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Ye.jsx)(Q.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Ye.jsxs)(Q.T,{size:12,colour:le.colours.muted,children:[Ys.length," live"]})]}),(0,Ye.jsx)(K.default,{style:{padding:10},children:(0,Ye.jsx)(at,{list:Ys,me:zt,compact:!0,bookings:kt})})]}):null,en=(Ee.DueToday,wt.settings.turnMins||90),tn=dl?hl:(0,v.todaysGuestList)(Ks,Ct,en),sn=dl?[]:(0,v.todaysFinishedList)(Ks,Ct,en),ln=dl?ul?`${cl}\u2019s guests`:`Guests ${cl}`:'Today\u2019s guests',nn=(0,Ye.jsxs)(Ye.Fragment,{children:[0===tn.length?(0,Ye.jsx)(Q.Muted,{children:dl?rl{const t=(0,v.isLeftEarly)(e,Ct,en),s=(0,ie.isSeatedHighlight)(e.status,{otherDay:dl})&&!t,l=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=le.colours.text,n=s?le.colours.goldLight:le.colours.muted,o=le.colours.gold,a=l.depositWarn?le.colours.amber:le.colours.goldLight;return(0,Ye.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:dl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ie.seatedHighlightStyle)({backgroundColor:e?Je:Qe,borderColor:le.colours.gold,borderLeftColor:le.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Ye.jsx)(Q.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Ye.jsx)(K.default,{style:{paddingTop:2},children:(0,Ye.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:le.colours.amber,ink:le.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Ye.jsx)(Q.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&de.OCCASION_ICON[l.occasion]?(0,Ye.jsx)(Q.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:de.OCCASION_ICON[l.occasion]}):null]}),(0,Ye.jsxs)(Q.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Ye.jsx)(Q.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Ye.jsx)(Q.T,{size:16,weight:"semibold",colour:a,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Ye.jsx)(Q.T,{size:16,colour:n,children:" \xb7 "}),(0,Ye.jsx)(Q.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Ye.jsx)(Q.T,{size:16,children:" "}):null,l.dog?(0,Ye.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Ye.jsx)(je.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Ye.jsx)(Q.T,{size:15,colour:le.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),sn.length?(0,Ye.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,padding:8,gap:4},children:[(0,Ye.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${sn.length}${ys?', expanded':', collapsed'}`,accessibilityState:{expanded:ys},onPress:()=>ps(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(Q.T,{size:16,weight:"semibold",colour:le.colours.goldLight,children:["Finished (",sn.length,")"]}),(0,Ye.jsx)(Q.T,{size:16,colour:le.colours.muted,children:ys?'\u25be':'\u25b8'})]}),ys?sn.map(e=>{const t=(0,me.guestRowText)(e,{name:e.walkIn?(0,xe.privName)(e,Et):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Ye.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{bs(!1),xs(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:le.colours.hairline,backgroundColor:e?le.colours.tilePressed:'transparent'}),children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",colour:le.colours.gold,style:{width:58},children:t.time}),(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Ye.jsxs)(Q.T,{size:15,colour:le.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Ye.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Ye.jsx)(S.BookingUndo,{b:e,rid:jt,today:Pt,who:t.name,allowed:Ii.ok})})]},e.id)}):null]}):null,(0,Ye.jsx)(Oe.CancellationsSection,{items:Pl,dayWord:dl?ul?cl.toLowerCase():`on ${cl}`:'today'})]}),on=(0,Ye.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:nn}),an=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&bs(!1)}}),rn=(0,Ye.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${ln}, ${tn.length}`,accessibilityState:{expanded:gs},'aria-expanded':gs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>bs(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:gs?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?le.colours.tilePressed:gs?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Ye.jsx)(Q.T,{size:16,weight:"bold",colour:le.colours.gold,children:tn.length}),(0,Ye.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Ye.jsxs)(Q.T,{size:13,weight:"semibold",colour:le.colours.goldLight,numberOfLines:1,children:[ln," ",gs?'\u2039':'\u203a']})})})]}),dn=Math.min(560,Math.max(320,.44*rt))<400,cn=gs?(0,Ye.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Ye.jsxs)(K.default,{testID:"guests-drawer",...an.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*rt)),backgroundColor:le.colours.surface,borderRightWidth:1,borderColor:le.colours.gold,borderRadius:14,..._e.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Ye.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Ye.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Ye.jsxs)(Q.T,{testID:"guests-heading",size:dn?14:17,weight:"semibold",colour:le.colours.gold,style:{flexShrink:1,minWidth:0},children:[ln.toUpperCase()," (",tn.length,")"]}),(0,Ye.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:us},'aria-expanded':us,onPress:()=>hs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:dn?8:12,borderRadius:12,borderWidth:1,borderColor:us?le.colours.gold:le.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?le.colours.tilePressed:us?le.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Ye.jsxs)(Q.T,{size:14,weight:"semibold",colour:le.colours.goldLight,children:[dn?'Key':'Guest key'," ",us?'\u25b4':'\u25be']})})]}),(0,Ye.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${ln}`,onPress:()=>bs(!1),style:{marginRight:-6,flexShrink:0}})]}),Hl.count?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,testID:"cancelled-day-tally-guests",children:Ml}):null,us?(0,Ye.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:le.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Ye.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Ye.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(Q.T,{size:16,children:e}),(0,Ye.jsx)(Q.T,{size:14,children:t})]},t))]}):null]}),on]}),(0,Ye.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${ln}`,accessibilityRole:"button",onPress:()=>bs(!1),style:{flex:1}})]}):null,un=jl?wl:l.IS_KIRKTON&&!Object.values(wt.kitchenHours??{}).some(Boolean)?(0,Ye.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[_e.look.panel,{padding:14,gap:8}],children:[(0,Ye.jsx)(Q.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Ye.jsx)(Q.Muted,{children:"No service hours have been set for this venue."})]}):(0,Ye.jsx)(Le.DayGraph,{busyThreshold:(0,t.venueBusy)(wt,kt,Ct).busy,todays:hl,open:yl,close:pl,now:Ct,turnBase:wt.settings.turnMins,blocks:Al,pauses:xl,compact:ut,dense:!ut,fit:gt,tight:gt&&ct<=600,height:gt?Si:vi,forecastNote:dl?void 0:Jl,emptyText:Il,past:rl{vs.current=Date.now(),Ds(!0)},shortDay:!ut&&rt<1100}),bn=(0,Ye.jsx)(Pe.DisplayCalendar,{visible:ks,today:Pt,day:rl,bookings:kt,restaurant:wt,now:Ct,onDay:Ss,onClose:()=>Ds(!1)}),yn=()=>{dl?bs(!0):qt(!0)},pn=(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Hi?4:ct<820?8:12,paddingTop:Hi?Di?2:4:ct<820?Di?4:6:Di?8:10,gap:Hi?8:12,minHeight:0,overflow:'hidden'},children:[Mt?null:rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Mt?null:pi,Mt?(0,Ye.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"})}):bi?gi:hi,yi,cn]}),(0,Ye.jsxs)(K.default,{testID:"display-side",style:{width:yt,gap:ct<820?4:8,minHeight:0},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:ki(!1)}),(0,Ye.jsx)(K.default,{style:{flexShrink:0},children:wi}),Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",onLayout:Ji,style:Di&&!Ui?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:ct<820,snug:ct<820,tight:ct<800,fill:Di&&!Ui,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{ref:Ri,testID:"day-graph-slot",onLayout:Ji,style:{flexGrow:0,flexShrink:Di?0:1,flexBasis:(ut?vi:Si)+(Di?Ai:Pi),height:(ut?vi:Si)+(Di?Ai:Pi),minHeight:ct<=600?90:Math.min((ut?vi:Si)+Le.DAY_GRAPH_CHROME,!ut&&ct>=768?140+Le.DAY_GRAPH_CHROME:120),overflow:'visible'},children:hn}),Di&&!Mt?(0,Ye.jsx)(K.default,{ref:Bi,testID:"display-side-split",onLayout:Ji,style:{flexShrink:0,alignItems:'center'},children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})}):null,(0,Ye.jsxs)(U.default,{testID:"display-side-scroll",style:Di?{flexGrow:0,flexShrink:1,minHeight:Li&&Ei?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Wi.current&&(Wi.current=s,zi(s),setTimeout(Ji,0))},children:[Di||mi?null:(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),Zi,(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt})]})]})]});return(0,Ye.jsxs)(Y.SafeAreaView,{style:{flex:1,backgroundColor:le.colours.bg},onTouchStart:()=>{vs.current=Date.now()},onMouseDown:()=>{vs.current=Date.now()},children:[ut?(0,Ye.jsx)(K.default,{style:{flex:1},children:(0,Ye.jsxs)(U.default,{ref:pt,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Ye.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Ye.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Ye.jsx)(j.ExitButton,{})}),(0,Ye.jsx)(Z.RestaurantLogo,{rid:jt,size:64}),(0,Ye.jsx)(Q.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:wt.name}),(0,Ye.jsx)(Z.PoweredBy,{}),(0,Ye.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Ye.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,te.hm)(Ct)}`,children:(0,Ye.jsx)(Q.T,{center:!0,size:30,weight:"semibold",colour:le.colours.goldLight,children:(0,te.hm)(Ct)})}),(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:"m"}),(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",size:"m"}),ee]}),Ve,k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt}),gn,(0,Ye.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Ye.jsx)(nt,{phone:!0,split:zl,items:[{label:`Tables \xb7 ${cl}`,value:Wl.length,testID:'badge-tables'},{label:`Covers \xb7 ${cl}`,value:Ll,testID:'badge-covers'},{label:'Takeaway',value:Ys.length,alert:Ys.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>is(!0)}]})}),(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:ki(!0)}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),wi,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[bi?gi:hi,yi]}),(0,Ye.jsxs)(K.default,{onLayout:e=>{ft.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[_e.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Ye.jsxs)(Q.T,{center:!0,size:20,weight:"semibold",colour:le.colours.goldLight,accessibilityRole:"header",children:[ln," (",tn.length,")"]}),(0,Ye.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:ln,style:{gap:4},children:nn})]}),Zi,hn,(0,Ye.jsx)(K.default,{testID:"covers-dock",children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>pt.current?.scrollTo({y:ft.current,animated:!0})})}),(0,Ye.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Ye.jsx)(Q.T,{center:!0,size:14,colour:Et?le.colours.muted:le.colours.amber,children:Et?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Ye.jsx)(Q.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>$s(!0),style:{minHeight:48,alignSelf:'stretch'}}),mi?null:(0,Ye.jsx)(Q.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ws(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Xi]})}):(0,Ye.jsxs)(Ye.Fragment,{children:[Di?(0,Ye.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:le.colours.hairline},children:(0,Ye.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Ye.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Ye.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:rt>=1e3?18:14,paddingVertical:Hi?2:ct<820?4:8,gap:8,minHeight:Hi&&Di?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),..._e.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:Di?16:8,minWidth:0,overflow:'hidden',...Di?{justifyContent:'flex-start'}:null},children:[(0,Ye.jsx)(K.default,{testID:"display-header-brand",style:Di?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Ye.jsx)(Z.RestaurantBrand,{rid:wt.id,size:rt<900?32:40,beside:!0,noLogo:Di})}),(0,Ye.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Ye.jsx)(Q.T,{size:rt<900?18:21,weight:"semibold",colour:le.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,te.hm)(Ct)}),rt>=900?(0,Ye.jsx)(Q.T,{size:13,colour:le.colours.muted,children:(0,te.niceDate)(Ct)}):null]})]}),Mt?(0,Ye.jsx)(K.default,{style:{width:220}}):(0,Ye.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:gn}),(0,Ye.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Ye.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:rt>=1400||Di?'row':'column',alignItems:rt>=1400||Di?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Ye.jsx)(Fe.ShellfishChip,{rid:jt,by:zt,app:"display",size:rt<1240?'xs':rt<1280||ct<700?'s':'m'}),Mt?null:(0,Ye.jsx)(Fe.SundayRoastChip,{rid:jt,by:zt,app:"display",slot:Di,size:rt<1340?'xs':rt<1400||ct<700?'s':'m'})]}),'simulated'===St?(0,Ye.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>vt(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(Q.T,{size:11,colour:le.colours.muted,children:"+15"})}):null,ee,e?null:(0,Ye.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Ye.jsx)(j.ExitButton,{size:44})})]})]}),Ve,k.IS_CAR||!Mt||Di?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(ke.BookingSaveBanner,{rid:jt,margin:{marginHorizontal:12,marginTop:6}}),Mt||Di?null:(0,Ye.jsx)(K.default,{testID:"display-day-stats",style:Ze,children:(0,Ye.jsxs)(K.default,{style:et,children:[k.IS_CAR?null:(0,Ye.jsx)(w.WhosOnShift,{compact:!0}),(0,Ye.jsx)(K.default,{style:tt,children:(0,Ye.jsx)(nt,{splitOnly:!0,split:zl,items:[]})})]})}),gt?pn:(fn=(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Ye.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:ki(!1)}),wi]}),(0,Ye.jsx)(We.BlocksBanner,{rid:jt,now:Ct,big:!0,by:zt}),Mt?(0,Ye.jsx)(A.DayView,{rid:jt,day:Mt,today:Pt,app:"display"}):(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[rn,(0,Ye.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[pi,bi?gi:hi,yi,cn]})]})}),Zi,Mt?null:(0,Ye.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Ye.jsx)(M.CoversToday,{rid:jt,day:rl,sound:(0,O.flapSoundOn)(),onPress:yn})}),Mt?null:(0,Ye.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:vi+Le.DAY_GRAPH_CHROME},children:hn})]}),(0,Ye.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:fn})),Xi]}),(0,Ye.jsx)($.SoldOutStrip,{rid:jt,by:Ht,onOpen:()=>Ps(!0)}),(0,Ye.jsx)(B.SoldOutSheet,{visible:Hs,onClose:()=>Ps(!1),rid:jt,by:Ht,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Ye.jsx)(p.TableOrderCue,{rid:jt}),At.elements,ns?(0,Ye.jsx)(y.EditBookingPicker,{rid:jt,today:Pt,who:zt,onClose:()=>os(!1)}):null,as?(0,Ye.jsx)(y.EditBookingSheet,{rid:jt,id:as,who:zt,onClose:()=>rs(null)}):null,Jt?(0,Ye.jsx)(Se.TableSheet,{rid:jt,name:Jt,view:Zs,plan:_t,todays:Ks,now:Ct,privacy:Et,turnBase:wt.settings.turnMins,onClose:()=>Xt(null),onWalkIn:e=>At.openWalkInAt(e),onMove:e=>es(e),onDetails:Us}):null,Dl?(()=>{const e=kl[Dl],t=e?.dayBookings??[];return(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>{Bl(null),vl(null)},title:`${(0,d.tableNumbersA11y)(Dl)} \xb7 ${ul?cl:(0,He.dayLong)(rl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Ye.jsxs)(Q.T,{size:16,center:!0,colour:le.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${ul?cl.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${ul?cl.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,xe.privName)(e,Et):st(e.name);return(0,Ye.jsx)(Q.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,De.tablesWords)((0,re.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{vl(null),xs(e.id)},style:{minHeight:56}},e.id)}),rl>=Pt?(()=>{const t=e?.table.maxSeats??0,s=kt.filter(e=>e.date===rl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,re.tablesOf)(e.table).includes(Dl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Ye.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Ye.jsxs)(Q.T,{size:17,weight:"semibold",center:!0,colour:le.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(Dl)]}),$l?(0,Ye.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:$l.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:le.colours.amber,backgroundColor:le.colours.amberBg},children:[(0,Ye.jsx)(Q.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:$l.ask}),(0,Ye.jsxs)(Q.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!Ii.ok,accessibilityHint:Ii.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=kt.find(e=>e.id===$l.id);if(Bl(null),!e)return;const s=st(e.name);vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es)}}),(0,Ye.jsx)(Q.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Bl(null)})]})]}):null,$l?null:s.slice(0,12).map(e=>{const s=st(e.name),l=e.partySize>t;return(0,Ye.jsx)(Q.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!Ii.ok,accessibilityHint:Ii.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(Dl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,ke.guardBookingChange)(Es,{b:e,tables:[Dl]}))return;const l=(0,De.overCapacityAsk)([Dl],t,e.partySize);l?Bl({id:e.id,ask:l}):(vl(null),await(0,ke.saveTablesReported)(jt,e,[Dl],s,t,Es))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Ye.jsx)(Q.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Bl(null),vl(null)},style:{minHeight:56}})]})})():null,fs?(()=>{const e=kt.find(e=>e.id===fs);return e?(0,Ye.jsx)(we.GuestActionsSheet,{rid:jt,b:e,name:e.walkIn?(0,xe.privName)(e,Et):st(e.name),view:Zs,now:Ct,otherDay:e.date!==Pt,turnBase:wt.settings.turnMins,onClose:()=>xs(null),onDetails:Us,onDone:Es,onEdit:e=>{xs(null),rs(e.id)},onPickOnPlan:(e,t)=>{bs(!1),Ut('plan'),Qt('all'),js({id:e.id,tables:t})}}):null})():null,ts?(0,Ye.jsx)(Se.DetailsPanel,{title:ts.title,onClose:()=>ss(null),children:ts.body}):null,bn,ds?(0,Ye.jsx)(Se.ServiceSummary,{r:wt,todays:Ks,orders:It,waitlistAll:Cs,walkInCount:Ts,onClose:()=>cs(!1)}):null,Rs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>$s(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Ye.jsx)(g.FloorLegend,{}),(0,Ye.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:le.colours.amber,ink:le.colours.bg}),(0,Ye.jsx)(Q.T,{size:14,children:"allergy"})]}),(0,Ye.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Ye.jsx)(je.DogIcon,{size:18}),(0,Ye.jsx)(Q.T,{size:14,children:"dog"})]}),(0,Ye.jsx)(Q.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>$s(!1)})]}):null,Ls?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>zs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Ye.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{zs(!1),Ws(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Ye.jsx)(Q.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>zs(!1)})]}):null,Bs?(0,Ye.jsxs)(Q.Sheet,{visible:!0,onClose:()=>Ws(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Ye.jsx)(J.ReviewsSection,{rid:jt,mode:"read",venueName:wt.name}),(0,Ye.jsx)(Q.Button,{kind:"secondary",label:"Close",onPress:()=>Ws(!1)})]}):null,ls?(0,Ye.jsxs)(Se.DetailsPanel,{title:"Takeaway",onClose:()=>is(!1),children:[(0,Ye.jsx)(Q.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Ye.jsx)(at,{list:Ys,me:zt,bookings:kt})]}):null,Ns?(0,Ye.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:le.colours.bg},children:(0,Ye.jsx)(ge.PlanDesigner,{initial:_t,venue:wt.name,mode:"display",startStep:"arrange",onActivity:()=>{Gs.current=Date.now(),null!==Fs&&Vs(null)},notice:null!==Fs?`Locking again in ${Fs} s \xb7 touch to keep editing`:null,onSave:e=>{re.useFloor.getState().setPlan(jt,e),_s(null),Es('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{re.useFloor.getState().setPlan(jt,e),Es('Live seating plan updated on every screen.')},onCancel:()=>{_s(null),Es('No changes kept. Editing is locked again.')}},Ns.at)}):null,e?null:(0,Ye.jsx)(pe.Screensaver,{rid:jt,idleMins:Ot.idleMins,pinOn:Ot.pinOn,wake:Ot,tonightCards:Ot.tonightCards,cfg:Nt}),e?null:(0,Ye.jsx)(Te.PrintHost,{rid:jt}),e?null:(0,Ye.jsx)(Ce.AlertHost,{variant:"display",rid:jt,skipTakeaway:!0}),e?null:(0,Ye.jsx)(E.SeatAllergenReminder,{rid:jt}),e?null:(0,Ye.jsx)(Re.TakeawayTakeover,{rid:jt,me:zt})]});var fn}function dt({rid:e,id:t,turnBase:s}){const l=(0,se.useBookings)(e).find(e=>e.id===t);return l?(0,Ye.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1053,779,805,806,1335,813,1336,1094,843,1140,1337,1338,1339,1091,1122,1340,1341,1346,1347,1204,1348,856,1353,1354,1355,1115,1113,920,1356,1153,891,1104,1357,17,1072,1179,1018,1087,1358,21,378,363,385,278,85,409,19,777,1231,1235,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1359,1108,1360,1366,1368,1372,1377,1371,1378,1381,1382,1117,1095,1096,862,1387,1220,1388,1230,1222,995,1393,1398,1399,1054,1052,1119,1401,1402,1403,1071,1172,1404,1171,1162,853,1349,1405,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},1333,[13,17,856,1334,1407,8]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return Ze}}),_e2.DisplayBoard=function(e={}){const t=(0,oe.useOwner)(e=>e.site);return(0,le.useRestaurant)(t)?(0,Qe.jsx)(dt,{...e}):(0,Qe.jsx)(K.default,{testID:"display-venue-loading",style:{flex:1,backgroundColor:ie.colours.bg,alignItems:'center',justifyContent:'center',padding:24},children:(0,Qe.jsx)(J.Muted,{center:!0,children:"Loading your venue\u2026"})})};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),o=_r(_d[5]),a=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),f=_r(_d[16]),x=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),I=_r(_d[20]),k=_r(_d[21]),D=_r(_d[22]),v=_r(_d[23]),S=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),R=_r(_d[27]),$=_r(_d[28]),B=_r(_d[29]),W=_r(_d[30]),L=_r(_d[31]),z=_r(_d[32]),H=_r(_d[33]),P=e(H),M=_r(_d[34]),A=_r(_d[35]),O=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=e(_r(_d[39])),G=e(_r(_d[40])),F=e(_r(_d[41])),V=e(_r(_d[42])),U=e(_r(_d[43])),K=e(_r(_d[44])),q=e(_r(_d[45])),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),oe=_r(_d[57]),ae=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),fe=_r(_d[68]),xe=_r(_d[69]),me=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]),Ie=_r(_d[73]),ke=_r(_d[74]),De=_r(_d[75]),ve=_r(_d[76]),Se=_r(_d[77]),Ce=_r(_d[78]),Te=_r(_d[79]),Re=_r(_d[80]),$e=_r(_d[81]),Be=_r(_d[82]),We=_r(_d[83]),Le=_r(_d[84]),ze=_r(_d[85]),He=_r(_d[86]),Pe=_r(_d[87]),Me=_r(_d[88]),Ae=_r(_d[89]),Oe=_r(_d[90]),Ee=_r(_d[91]),Ne=_r(_d[92]),_e=_r(_d[93]),Ge=_r(_d[94]),Fe=_r(_d[95]),Ve=_r(_d[96]),Ue=_r(_d[97]),Ke=_r(_d[98]),qe=_r(_d[99]),Ye=_r(_d[100]),Qe=_r(_d[101]);const Je='#221C12',Xe='#2E2618',Ze=12e4,et={paddingHorizontal:12,paddingTop:2,paddingBottom:2,alignItems:'center'},tt={flexDirection:'row',flexWrap:'nowrap',justifyContent:'center',alignItems:'center',gap:10,alignSelf:'stretch'},st={width:k.IS_CAR?560:400,maxWidth:'100%',flexShrink:0},lt=e=>(e??'').replace(' (example)',''),it=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),nt=e=>e.slotTime?(0,se.hm)(new Date(e.slotTime)):'ASAP';function ot({items:e,tight:t,phone:s,split:l,inline:i,splitOnly:n}){return(0,Qe.jsxs)(K.default,{style:{borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden',alignSelf:n?'center':'stretch',maxWidth:n?560:void 0,width:n?'100%':void 0,flexDirection:i?'row':'column',alignItems:'center'},children:[n?null:(0,Qe.jsx)(K.default,{style:{flexDirection:'row',flexWrap:s?'wrap':'nowrap',justifyContent:'center',alignItems:'center',flexShrink:i?0:void 0},children:e.map((e,l)=>{const i=(0,Qe.jsxs)(K.default,{testID:e.testID,style:{flex:s?1:void 0,minWidth:s?148:void 0,flexBasis:s?148:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,Qe.jsx)(J.T,{size:s?24:19,weight:"semibold",colour:e.alert?ie.colours.amber:ie.colours.text,children:e.value}),(0,Qe.jsx)(J.T,{size:s?14:12,colour:ie.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:148,flexBasis:148}:void 0,children:i},e.testID):(0,Qe.jsx)(P.default.Fragment,{children:i},e.testID)})}),l?(0,Qe.jsx)(K.default,{testID:"covers-split",accessible:!0,accessibilityLabel:l.a11y,style:{width:i?void 0:'100%',flex:i?1:void 0,minWidth:i?180:void 0,paddingHorizontal:12,paddingBottom:i?6:8,paddingTop:i?6:8,gap:4,alignItems:'center',justifyContent:'center',borderTopWidth:i||n?0:1,borderLeftWidth:i?1:0,borderTopColor:'rgba(207,164,95,0.35)',borderLeftColor:'rgba(207,164,95,0.35)'},children:l.empty?(0,Qe.jsx)(J.T,{size:14,colour:ie.colours.muted,children:"No Covers yet"}):(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',justifyContent:'center',gap:i?12:18,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",colour:ie.colours.gold,children:`Walk-ins ${l.walkIns} \xb7 ${l.walkInPct}%`}),(0,Qe.jsx)(J.T,{size:i?13:14,weight:"semibold",children:`Bookings ${l.bookings} \xb7 ${l.bookingPct}%`})]}),(0,Qe.jsxs)(K.default,{style:{width:'100%',maxWidth:i?280:420,height:6,borderRadius:3,overflow:'hidden',flexDirection:'row',backgroundColor:'#0B0B0B',borderWidth:1,borderColor:ie.colours.gold},children:[(0,Qe.jsx)(K.default,{style:{width:`${l.walkInPct}%`,backgroundColor:ie.colours.gold}}),(0,Qe.jsx)(K.default,{style:{flex:1,backgroundColor:'#0B0B0B'}})]})]})}):null]})}function at({chipId:e,label:t,sub:s,selected:l,onPress:i,colour:n,compact:o}){return(0,Qe.jsxs)(V.default,{testID:`area-chip-${e}`,accessibilityRole:"button",accessibilityState:{selected:l},accessibilityLabel:`${t}${s?`, ${s}`:''}${l?', selected':''}`,'aria-pressed':l,onPress:i,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',flexShrink:0,gap:o?4:7,minHeight:44,paddingHorizontal:o?6:14,borderRadius:999,borderWidth:1,borderColor:l?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:l?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[n?(0,Qe.jsx)(K.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:n}}):null,(0,Qe.jsx)(J.T,{size:o?12:14,weight:l?'semibold':'medium',colour:l?ie.colours.goldLight:'#CFC8BA',numberOfLines:1,center:!1,children:t}),s?(0,Qe.jsx)(J.T,{size:12,colour:ie.colours.muted,children:s}):null]})}function rt({list:e,me:t,compact:s,bookings:l}){const i=(e,t)=>(0,Ke.statusBlock)(e,t,(0,Ke.linkedBooking)(e,l));return e.length?(0,Qe.jsx)(K.default,{style:{gap:8},children:e.map(e=>(0,Qe.jsxs)(K.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:ie.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?ie.colours.ok:e.allergies.length?ie.colours.red:ie.colours.gold},children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:s?16:18,weight:"bold",children:[nt(e)," \xb7 ",lt(e.customerName)]}),(0,Qe.jsx)(J.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,Qe.jsxs)(J.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,te.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,Qe.jsx)(Ue.AllergyChain,{o:e,me:t,compact:!0}):null,(0,Qe.jsxs)(J.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,Qe.jsx)(J.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>le.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,Qe.jsx)(J.Button,{small:!0,kind:"success",label:i(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!i(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,Qe.jsx)(J.Button,{small:!0,label:i(e,'collected')?'Sign-offs needed':'Collected',disabled:!!i(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>le.repo.orders.setStatus(e.id,'collected',t)}):null,(0,Qe.jsx)(Re.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,Qe.jsx)(J.Muted,{children:"No takeaway orders right now."})}function dt({embedded:e=!1,boardW:b,headerExtra:te,subHeader:Ue,noVoice:Ke=!1}={}){const nt=(0,q.default)(),dt=b??nt.width,ut=nt.height,ht=dt<700,gt=dt>=ut,bt=!ht&>&&dt>=600,yt=bt,pt=Math.round(Math.min(520,Math.max(dt>=1e3?448:280,.3*dt))),ft=P.default.useRef(null),xt=P.default.useRef(0),[mt,jt]=(0,H.useState)({w:0,h:0}),wt=(0,oe.useOwner)(e=>e.site),It=(0,le.useRestaurant)(wt);(0,Be.useAlertWatcher)(wt,{enabled:!e});const kt=(0,le.useOrders)(wt),Dt=(0,le.useBookings)(wt),vt=(0,le.useEvents)(wt),St=(0,le.useStore)(e=>e.skipMinutes),Ct=(0,le.useStore)(e=>e.clock.mode),Tt=(0,le.useNow)(5e3),Rt=(0,oe.useOwner)(e=>e.staff),$t=(0,oe.useOwner)(e=>e.attendance),Bt=(0,oe.useOwner)(e=>e.shifts),Wt=(0,oe.useOwner)(e=>e.leave),Lt=P.default.useMemo(()=>(0,_e.workingShifts)(Bt,Wt),[Bt,Wt]);P.default.useEffect(()=>{(0,re.ensureAttendance)((0,se.ymd)(Tt),Tt)},[(0,se.ymd)(Tt)]);const zt=(0,R.useSession)(e=>e.meId),Ht=(0,D.displayActionBy)({isCar:k.IS_CAR,isDisplayApp:'display'===k.APP_VARIANT&&!e,personName:lt(Rt.find(e=>e.id===zt)?.name)}),Pt=k.IS_CAR?'Car':'Display';(0,W.useSoldOutLink)(!1,e?void 0:Pt,!0);const Mt=(0,se.ymd)(Tt),At=(0,A.useTravelDay)('display',Mt),Ot=(0,ae.useFrontDoor)(Mt,gt),Et=(0,de.useDisplaySettings)(wt),Nt=Et.privacy,_t=(0,xe.useSaverSync)(),Gt=(0,de.usePlan)(wt),Ft=(0,de.useFloor)(e=>e.live[wt]),Vt=(0,We.useBlocks)(e=>e.blocks),[Ut,Kt]=(0,H.useState)('plan'),[qt,Yt]=(0,H.useState)(!1),[Qt,Jt]=(0,H.useState)('all'),[Xt,Zt]=(0,H.useState)(null),[es,ts]=(0,H.useState)(null),[ss,ls]=(0,H.useState)(null),[is,ns]=(0,H.useState)(!1),[os,as]=(0,H.useState)(!1),[rs,ds]=(0,H.useState)(null),[cs,us]=(0,H.useState)(!1),[hs,gs]=(0,H.useState)(!1),[bs,ys]=(0,H.useState)(!1),[ps,fs]=(0,H.useState)(!1),[xs,ms]=(0,H.useState)(null),[js,ws]=(0,H.useState)(null),[Is,ks]=(0,H.useState)(null),[Ds,vs]=(0,H.useState)(!1),Ss=P.default.useRef(0),Cs=e=>{Ss.current=Date.now(),ks(e)};P.default.useEffect(()=>{if(!Is)return;const e=setInterval(()=>{Date.now()-Ss.current>=Pe.DAY_IDLE_MS&&ks(null)},5e3);return()=>clearInterval(e)},[Is]);const Ts=(0,le.useWaitlist)(wt),Rs=(0,le.useStore)(e=>e.walkIns[wt]??0),[$s,Bs]=(0,H.useState)(!1),[Ws,Ls]=(0,H.useState)(!1),[zs,Hs]=(0,H.useState)(!1),[Ps,Ms]=(0,H.useState)(!1);(0,Z.useReviewAlerts)(wt);const[As,Os]=(0,H.useState)({view:0,content:0}),[Es,Ns]=(0,H.useState)(null);P.default.useEffect(()=>{Es&&((0,L.notify)({id:`floor-note:${Date.now()}`,title:Es,timeoutMs:4500,big:!0,testID:'floor-toast'}),Ns(null))},[Es]),P.default.useEffect(()=>{if(!e)return(0,O.setDisplaySilent)(!0),()=>(0,O.setDisplaySilent)(!1)},[e]);const[_s,Gs]=(0,H.useState)(null),Fs=P.default.useRef(0),[Vs,Us]=(0,H.useState)(null);P.default.useEffect(()=>{if(!_s)return;Fs.current=Date.now();const e=setInterval(()=>{const e=Date.now()-Fs.current;if(e>=Ze)return Gs(null),void Ns('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Us(e>=105e3?Math.ceil((Ze-e)/1e3):null)},1e3);return()=>clearInterval(e)},[_s]);const Ks=e=>e.date!==Mt?ls({title:`Guest details \xb7 ${(0,Pe.dayWord)(e.date,Mt)} ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[!e.walkIn&&e.date>Mt?(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${(0,Pe.dayWord)(e.date,Mt)}, ${e.time}`,disabled:!ki.ok,accessibilityHint:ki.hint,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}):null,(0,Ce.bookingDetails)(e)]})}):ls({title:`Guest details \xb7 ${e.time}`,body:(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(ct,{rid:wt,id:e.id,turnBase:It.settings.turnMins}),e.walkIn?null:(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ls(null),ds(e.id)},style:{minHeight:56}}),e.walkIn?(0,Qe.jsx)(ke.CancelWalkInButton,{rid:wt,b:e,big:!0,onDone:e=>{ls(null),Ns(e)}}):null,e.walkIn?(0,Qe.jsx)(ke.ReinstateWalkInButton,{rid:wt,b:e,today:Mt,onDone:e=>{ls(null),Ns(e)}}):null,(0,Ce.bookingDetails)(e)]})}),qs=Dt.filter(e=>e.date===Mt).sort((e,t)=>e.time.localeCompare(t.time)),Ys=qs.filter(e=>!['cancelled','noshow'].includes(e.status)),Qs=kt.filter(it).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),Js=(0,H.useMemo)(()=>(0,c.forecastToday)(It,Dt,kt,vt,Tt),[It,Dt,kt,vt,Tt.getTime()/6e4|0]),Xs=(0,We.closedAreasAt)(Vt,wt,Mt,(0,se.hm)(Tt)),Zs=[...Xs].join(','),el=(0,H.useMemo)(()=>(0,ce.floorView)(Gt,Dt,kt,Ft??{},Tt,It.settings.turnMins,Xs),[Gt,Dt,kt,Ft,Tt.getTime(),Zs]),tl=(0,Se.hoursFor)(It,Tt),sl=tl?.open??new Date(`${Mt}T12:00:00`),ll=tl?.close??new Date(`${Mt}T21:00:00`),il=(0,se.addMins)(sl,-sl.getMinutes()),nl=(0,se.addMins)(ll,30),ol=e=>new Date(`${Mt}T${e}:00`),al=(0,We.blocksOn)(Vt,wt,Mt).map(e=>({from:ol(e.from),to:ol(e.to),label:e.reason??'Paused'})).concat((0,n.queuedServicePauses)(It,Tt,Mt)),rl=Object.keys(el).filter(e=>'blocked'===el[e]?.status),dl=Is&&Is!==Mt?Is:Mt,cl=dl!==Mt,ul=(0,Pe.dayWord)(dl,Mt),hl=/^(Today|Yesterday|Tomorrow)$/.test(ul),gl=cl?(0,Pe.bookingsForDay)(Dt,dl,Mt).sort((e,t)=>e.time.localeCompare(t.time)):qs,bl=(0,se.parseYmd)(dl);bl.setHours(12);const yl=cl?(0,Se.hoursFor)(It,bl):tl,pl=yl?.open??new Date(`${dl}T12:00:00`),fl=yl?.close??new Date(`${dl}T21:00:00`),xl=e=>new Date(`${dl}T${e}:00`),ml=[...cl?(0,We.blocksOn)(Vt,wt,dl).map(e=>({from:xl(e.from),to:xl(e.to),label:e.reason??'Paused'})):al,...cl?(0,n.queuedServicePauses)(It,bl,dl):[]],jl=(0,n.queuedServiceSessions)(It,bl),wl=l.IS_QUEUED_VENUE&&(void 0===jl||!jl.length),Il=(0,Qe.jsxs)(K.default,{testID:"queued-hours-gate",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:void 0===jl?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,Qe.jsx)(J.Muted,{children:i.queuedVenues[wt]?.hours.note})]}),kl=cl?yl||gl.length?dlcl?(0,ce.dayFloorView)(Gt,gl,dl):el,[cl,Gt,gl,dl,el]),[vl,Sl]=(0,H.useState)(null),[Cl,Tl]=(0,H.useState)(null),[Rl,$l]=(0,H.useState)(!1),[Bl,Wl]=(0,H.useState)(null),Ll=cl?gl.filter(e=>!['cancelled','noshow'].includes(e.status)):Ys,zl=Ll.reduce((e,t)=>e+t.partySize,0),Hl=(0,u.coversSplit)(Ll,dl),Pl=(0,Ae.cancelledDayTally)(Dt,dl),Ml=(0,Oe.cancellationsFor)(Dt,dl,e=>e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)','')),Al=(0,Ae.cancelledTallyWords)(Pl,hl?ul.toLowerCase():cl?`on ${ul}`:'today'),Ol=Vt.filter(e=>e.rid===wt&&e.date===dl&&!e.removedAt),El=60*pl.getHours()+pl.getMinutes(),Nl=60*fl.getHours()+fl.getMinutes(),_l=(0,He.chartBands)(Ol,El,Nl),Gl=(0,He.seasonClosedAreaIds)(Ol,El,Nl),Fl=Gl.size?{...Gt,areas:Gt.areas.filter(e=>!Gl.has(e.id)),tables:Gt.tables.filter(e=>!Gl.has(e.areaId))}:Gt,Vl=cl?[]:rl.filter(e=>!Gl.has(Gt.tables.find(t=>t.name===e)?.areaId??'')),Ul=new Set((0,He.blockedHours)(_l)),Kl=Tt.getHours()+(Tt.getMinutes()>=30?1:0),ql=Js.hours.filter(e=>e.hour>=Kl&&!Ul.has(e.hour)),Yl=ql.reduce((e,t)=>e+t.coversHigh,0),Ql=ql.reduce((e,t)=>e+t.coversLow,0),Jl=Math.round((Ql+Yl)/2),Xl=!Js.example&&Js.open&&Js.enough&&Yl>0?`Usually ${(0,c.coversRange)(Jl,Jl)} more`:void 0,Zl=async(e,t)=>{const s=el[e]?.booking;if(!s||e===t)return;const l=el[t]?.status;if(l&&!['free','soon'].includes(l))return void Ns('dirty'===l?`${(0,d.tableNumbers)(t)} needs clearing first.`:`${(0,d.tableNumbers)(t)} is ${ce.STATUS[l].label.toLowerCase()}. Pick a free table.`);if(!(0,De.guardBookingChange)(Ns,{b:s,tables:[t]}))return;await le.repo.bookings.update(s.id,{table:t});const i=Ft?.[e]?.stage;de.useFloor.getState().setLive(wt,t,{stage:i??'seated',dirty:!1}),de.useFloor.getState().setLive(wt,e,{stage:void 0,dirty:!0}),Ns(`Saving: ${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}\u2026`),(0,De.reportBookingSave)(s.id,`${(0,me.privName)(s,Nt)} moved ${(0,d.tableNumbers)(e)} \u2192 ${t}. ${(0,d.tableNumbers)(e)} needs clearing.`,`${(0,me.privName)(s,Nt)} to ${(0,d.tableNumbers)(t)}`,Ns)},ei=e=>{if(js)return Tl(null),void ws(t=>t?{...t,tables:(0,ve.toggleTable)(t.tables,e)}:t);cl?Sl(e):es?(e!==es&&Zl(es,e),ts(null)):Zt(e)},ti=js?Dt.find(e=>e.id===js.id):void 0,si=js&&ti?(()=>{const e=ti.walkIn?(0,me.privName)(ti,Nt):lt(ti.name),t=(0,ve.seatsOf)(Gt,js.tables).total,s=(0,ve.seatLine)(t,ti.partySize),l=(0,ve.pickClashes)(ti,js.tables,Dt.filter(e=>e.date===ti.date),It.settings.turnMins),i=(0,ve.tableKey)(js.tables)!==(0,ve.tableKey)((0,de.tablesOf)(ti.table));return(0,Qe.jsxs)(K.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:ie.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,padding:10},children:[(0,Qe.jsxs)(K.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,Pe.dayWord)(ti.date,Mt)} ${ti.time}. Tap tables on the plan to add or take them off. ${(0,ve.tablesWords)(js.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",colour:ie.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,Pe.dayWord)(ti.date,Mt)," ",ti.time]}),(0,Qe.jsxs)(J.T,{size:16,colour:ie.colours.text,children:[(0,ve.tablesWords)(js.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,d.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),Cl?(0,Qe.jsx)(K.default,{testID:"plan-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Cl,style:{padding:10,borderRadius:10,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:(0,Qe.jsx)(J.T,{size:16,weight:"semibold",center:!0,colour:"#FFE2A8",children:Cl})}):null,Rl&&ti&&js.tables.length?(0,Qe.jsx)(C.RestoreSeatedConfirm,{prompt:(0,T.restoreSeatedPrompt)(e,js.tables.join('+')),onYes:()=>{$l(!1),(async()=>{if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,s,e,t,Ns)})()},onNo:()=>$l(!1)}):null,(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:Cl?'plan-pick-overcap-yes':'plan-pick-save',label:Cl?'Use it anyway':l.length?'Save anyway':'Save tables',disabled:!i,style:{minHeight:56},accessibilityLabel:`${Cl?'Use it anyway':l.length?'Save anyway':'Save'}, ${(0,ve.tablesWords)(js.tables)} for ${e}. ${s.text}.`,onPress:async()=>{if(!ti)return void ws(null);if(!(0,De.guardBookingChange)(Ns,{b:ti,tables:js.tables}))return Tl(null),void ws(null);const s=(0,ve.overCapacityAsk)(js.tables,t,ti.partySize);if(s&&!Cl)return void Tl(s);if('finished'===ti.status&&js.tables.length&&!Rl)return void $l(!0);Tl(null),$l(!1);const l=js.tables;ws(null),await(0,De.saveTablesReported)(wt,ti,l,e,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>{Tl(null),ws(null)}})]})]})})():null,li=Fl.areas.filter(e=>Fl.tables.some(t=>t.areaId===e.id)),ii=e=>{const t=Gt.tables.filter(t=>t.areaId===e);return cl?`${t.filter(e=>!Dl[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(el[e.name]?.status??'free')).length}/${t.length} free`},ni='all'===Qt||li.some(e=>e.id===Qt)?Qt:'all',oi=e=>(0,Qe.jsx)(ue.FloorCanvas,{plan:Fl,areaId:e,mode:"live",fit:"contain",crop:!0,fill:bt,big:!0,view:Dl,privacy:Nt,turnBase:It.settings.turnMins,highlight:js?js.tables:es?[es]:void 0,onTap:e=>ei(e.name),onDrop:(e,t)=>js||cl?void 0:Zl(e.name,t.name)}),ai=ht?1:gt||li.length>2?2:1,ri=e=>{const t=Gt.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},di=[];for(let e=0;e{const t=(0,ue.areaBounds)(Gt,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,ue.minReadableScale)(Gt,e.id)}}),mt.w,mt.h):null,ui=e=>(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',height:he.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:ii(e.id)})]}),hi=(0,Qe.jsx)(K.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-mt.w)>1||Math.abs(s-mt.h)>1)&&jt({w:t,h:s})},children:ci?(0,Qe.jsx)(U.default,{style:{flex:1},scrollEnabled:ci.scroll,showsVerticalScrollIndicator:ci.scroll,contentContainerStyle:{gap:he.GRID_GAP},children:ci.rows.map((e,t)=>(0,Qe.jsx)(K.default,{style:{height:ci.rowHeights[t],flexDirection:'row',gap:he.GRID_GAP},children:e.map(e=>{const t=li.find(t=>t.id===e);return(0,Qe.jsxs)(K.default,{testID:`area-cell-${e}`,style:{width:ci.cellW,gap:2},children:[ui(t),(0,Qe.jsx)(K.default,{style:{flex:1},children:oi(e)})]},e)})},t))}):null}),gi=(0,Qe.jsxs)(K.default,{testID:"venue-plan",style:{flex:ht?void 0:1,gap:10,minWidth:0},children:[(0,Qe.jsx)(r.TableNumberWarning,{plan:Gt}),Gt.tables.length?null:(0,Qe.jsxs)(K.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,Qe.jsx)(J.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,Qe.jsx)(J.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."}),l.IS_WILDINGS||l.IS_KIRKMICHAEL||l.IS_SOUTERS?(0,Qe.jsx)(J.Muted,{center:!0,testID:"display-venue-hours",children:(l.IS_WILDINGS?a.WILDINGS_GUIDE:l.IS_KIRKMICHAEL?a.KIRKMICHAEL_GUIDE:a.SOUTERS_GUIDE).hoursLines.join(' \xb7 ')}):null]}),(()=>{const e=[(0,Qe.jsx)(at,{chipId:"all",compact:!ht,label:"Whole venue",selected:'all'===ni,onPress:()=>Jt('all')},"__all"),...li.map(e=>(0,Qe.jsx)(at,{chipId:e.id,compact:!ht,label:`${e.name}${(0,ge.areaMarks)(e)}`,colour:(0,ie.brandColour)(e.colour),sub:ht?Xs.has(e.id)?'closed':ni===e.id?ii(e.id):void 0:void 0,selected:ni===e.id,onPress:()=>Jt(e.id)},e.id))];return ht?(0,Qe.jsx)(K.default,{testID:"area-chips",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8,maxWidth:'100%'},children:e}):(0,Qe.jsx)(U.default,{horizontal:!0,testID:"area-chips",showsHorizontalScrollIndicator:!1,onLayout:e=>{const t=e.nativeEvent.layout.width;Os(e=>e.view===t?e:{...e,view:t})},onContentSizeChange:e=>Os(t=>t.content===e?t:{...t,content:e}),style:{flexGrow:0,flexShrink:0,maxHeight:48,alignSelf:'stretch'},contentContainerStyle:{flexDirection:'row',flexWrap:'nowrap',alignItems:'center',justifyContent:As.view>0&&As.content>0&&As.content<=As.view+1?'center':'flex-start',gap:4,paddingRight:4,minWidth:As.view>0&&As.content<=As.view+1?'100%':void 0},children:e})})(),(0,Qe.jsx)(g.FloorLegend,{}),si,es?(0,Qe.jsxs)(J.Row,{gap:8,style:{backgroundColor:ie.colours.goldTint,borderRadius:10,padding:8},children:[(0,Qe.jsxs)(J.T,{weight:"semibold",colour:ie.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,d.tableNumbers)(es),": tap the new table."]}),(0,Qe.jsx)(J.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ts(null)})]}):null,'all'===ni&&bt?hi:'all'===ni?(0,Qe.jsx)(K.default,{style:{flex:ht?void 0:1,gap:12,minHeight:yt?void 0:360},children:di.map((e,t)=>(0,Qe.jsxs)(K.default,{style:{flex:ht?void 0:Math.max(.3,...e.map(e=>ri(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,Qe.jsxs)(K.default,{style:{flex:1,gap:2},children:[ht?(0,Qe.jsxs)(K.default,{style:{alignItems:'center',gap:4},children:[(0,Qe.jsxs)(J.T,{center:!0,size:18,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{center:!0,size:14,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{center:!0,children:ii(e.id)})]}):(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between'},children:[(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:(0,ie.brandColour)(e.colour),children:[e.name,(0,ge.areaMarks)(e)]}),Xs.has(e.id)?(0,Qe.jsx)(J.T,{size:13,weight:"semibold",colour:ie.colours.blue,children:"Closed for weather"}):(0,Qe.jsx)(J.Muted,{children:ii(e.id)})]}),(0,Qe.jsx)(K.default,{style:ht?{height:Math.max(280,Math.round((dt-40)*ri(e.id)))}:{flex:1},children:oi(e.id)})]},e.id)),e.length{if(cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},dl)}),yi='timeline'===Ut,pi=qt?(0,Qe.jsx)(G.default,{visible:!0,transparent:!1,animationType:"fade",onRequestClose:()=>Yt(!1),supportedOrientations:['landscape','portrait'],children:(0,Qe.jsxs)(K.default,{testID:"timeline-full",accessibilityViewIsModal:!0,style:{flex:1,backgroundColor:ie.colours.bg,paddingHorizontal:10,paddingTop:6,paddingBottom:6,gap:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:12,minHeight:64},children:[(0,Qe.jsx)(V.default,{testID:"timeline-back",accessibilityRole:"button",accessibilityLabel:"Back to the table plan",onPress:()=>Yt(!1),style:{minHeight:64,minWidth:dt<600?120:180,paddingHorizontal:dt<600?14:22,borderRadius:16,borderWidth:2,borderColor:ie.colours.goldLight,backgroundColor:ie.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:22,weight:"bold",colour:"#16120B",center:!0,children:"\u2039 Back"})}),(0,Qe.jsx)(K.default,{style:{flex:1,alignItems:'center',minWidth:0},children:(0,Qe.jsx)(J.T,{size:22,weight:"semibold",colour:ie.colours.goldLight,center:!0,numberOfLines:1,accessibilityRole:"header",children:`Timeline \xb7 ${cl?(0,Pe.dayLong)(dl):'Today'}`})}),dt<600?null:(0,Qe.jsx)(K.default,{style:{minWidth:180}})]}),wl?Il:(0,Qe.jsx)(K.default,{style:{flex:1,minHeight:0},children:(0,Qe.jsx)(pe.Timeline,{isToday:!cl,fit:!0,plan:Fl,bookings:cl?gl:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,t0:cl?(0,se.addMins)(pl,-pl.getMinutes()):il,t1:cl?(0,se.addMins)(fl,30):nl,pauses:cl?ml:al,blockedTables:Vl,onOpen:e=>{if(Yt(!1),cl)return void ms(e.id);const t=(0,de.tablesOf)(e.table)[0];t&&el[t]?Zt(t):Ks(e)}},`full-${dl}`)})]})}):null,fi=cl?(0,Qe.jsxs)(K.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:8,marginBottom:4,paddingVertical:2,paddingHorizontal:8,minHeight:44,borderRadius:12,borderWidth:1,borderColor:ie.colours.gold,backgroundColor:ie.colours.goldTint},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,style:{flex:1},accessibilityRole:"header",children:hl?`Showing ${ul} \xb7 ${(0,se.niceDate)((0,se.parseYmd)(dl))}`:`Showing ${(0,Pe.dayWord)(dl,Mt)}`}),(0,Qe.jsx)(K.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:`${Al}. Showing ${(0,Pe.dayLong)(dl)}. Guests, table plan, Timeline and Covers are for that day.`,style:{position:'absolute',width:1,height:1,overflow:'hidden'}}),(0,Qe.jsx)(J.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{ws(null),Cs(null)},style:{minHeight:44}})]}):null,xi=(0,Qe.jsx)(K.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:ht?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,t,s])=>{const i='timeline'===e===(yi||qt);return(0,Qe.jsx)(V.default,{testID:s,accessibilityRole:"tab",accessibilityLabel:t,accessibilityState:{selected:i},accessibilityHint:'timeline'===e?'Opens the timeline over the whole screen':void 0,onPress:()=>{'timeline'===e?(Kt('plan'),Yt(!0)):(Yt(!1),Kt('plan'))},style:{flex:ht?1:void 0,minHeight:ht?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:i?ie.colours.gold:'transparent',...Ge.look.web(i?{backgroundImage:l.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:l.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,Qe.jsx)(J.T,{size:ht?16:13,weight:"semibold",colour:i?'#16120B':'#BDB5A6',children:t})},e)})}),mi='display'===k.APP_VARIANT&&!e,ji='display'===k.APP_VARIANT&&!e,wi=!e&&!k.IS_CAR&&!ht,Ii=mi?(0,Qe.jsxs)(K.default,{testID:"display-view-row",style:{flexDirection:ht?'column':'row',flexWrap:ht||wi?'nowrap':'wrap',gap:6,alignItems:ht||wi?'stretch':'center'},children:[xi,(0,Qe.jsx)(I.DisplayRotaKitchenButtons,{phone:ht,fill:wi,shifts:Bt,staff:Rt,today:Mt,leave:Wt})]}):xi,ki=(0,h.useBookingWrite)(),Di=e=>(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Walk-in",onPress:Ot.openWalkIn,testID:"add-walkin",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"New booking",onPress:Ot.openBooking,testID:"add-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint}),(0,Qe.jsx)(Fe.BigAction,{premium:!0,label:"Edit booking",onPress:()=>as(!0),testID:"display-edit-booking",block:e,size:"s",disabled:!ki.ok,accessibilityHint:ki.hint})]});(0,Ye.useDisplayNotices)(wt,!e);const vi=!e&&!k.IS_CAR&&!ht,Si=ht?180:202,[Ci,Ti]=(0,H.useState)(ht?180:168),Ri=P.default.useRef(ht?180:168),$i=P.default.useRef(null),Bi=P.default.useRef(null),Wi=P.default.useRef(null),Li=P.default.useRef(!1),[zi,Hi]=(0,H.useState)(!1),Pi=!ht&&ut<=800,Mi=ze.DAY_GRAPH_CHROME+(Pi?24:8),Ai=P.default.useRef(0),[Oi,Ei]=(0,H.useState)(Mi),[Ni,Gi]=(0,H.useState)(!0),Fi=`${nt.width}x${ut}`,[Vi,Ui]=(0,H.useState)(null),Ki=Vi===Fi,qi=P.default.useRef(null),Yi=P.default.useRef(0),Qi=P.default.useRef(()=>{}),Ji=P.default.useCallback(e=>{Math.abs(e-Ai.current)>=2&&(Ai.current=e,setTimeout(()=>Qi.current(),0))},[]),Xi=()=>{const e=$i.current,t=Bi.current;if(!e?.measureInWindow||!t?.measureInWindow)return;const s=(e,t,s,l,i=0)=>{const n=_.default.get('window');if(t<=0||s<=e)return;if((s>n.height+2||n.width!==nt.width||n.height!==ut)&&Yi.current<5)return Yi.current+=1,void setTimeout(()=>Qi.current(),450);Yi.current=0;const o=t>Ri.current?Math.ceil(t-Ri.current):0,a=vi?Math.max(Mi,Ai.current):Math.max(Mi,o);vi&&a!==Oi&&Ei(a);const r=!ht&&ut>=700?140:70,d=Math.floor(s-4-e)-a-l,c=i>0&&d-i>=r;if(vi&&c!==Ni&&Gi(c),vi&&!Ki)if(d<48){const e=qi.current,t=Date.now();e&&e.key===Fi&&t-e.at>=300?(qi.current=null,Ui(Fi)):(e&&e.key===Fi||(qi.current={key:Fi,at:t}),setTimeout(()=>Qi.current(),450))}else qi.current=null;const u=d-(c?i:0),h=Math.min(Si,u>=r?Math.max(r,u):Math.max(0,u));Math.abs(Ri.current-h)>=2&&(Ri.current=h,Ti(h))},l=44+(ut<820?4:8),i=46+(ut<820?4:8);e.measureInWindow((e,n,o,a)=>{t.measureInWindow((e,t)=>{const o=Wi.current;vi&&o?.measureInWindow?o.measureInWindow((e,l,o,r)=>{const d=ut<820?4:8;s(n,a,t,Math.max(i,d+Math.round(r||0)),Li.current?44+d:0)}):s(n,a,t,vi?i:l)})})};Qi.current=Xi,P.default.useEffect(()=>{const e=setTimeout(()=>Qi.current(),60),t=setTimeout(()=>Qi.current(),450);return()=>{clearTimeout(e),clearTimeout(t)}},[dt,ut,dl]);const Zi=(0,Qe.jsxs)(K.default,{ref:Bi,testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||x.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)}),Xi()},style:{flexDirection:'row',flexWrap:dt>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:ht?12:Pi?2:6,justifyContent:ht?'center':void 0,borderTopWidth:1,borderTopColor:ie.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,Qe.jsx)(qe.DisplayClockButton,{}),(0,Qe.jsx)(ye.HoldToEdit,{quiet:!0,onUnlock:()=>{Us(null),Gs({at:Date.now()})},onHint:()=>Ns('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,Qe.jsx)(Le.BlockBookingsButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,display:!0,day:dl}),Gt.areas.some(e=>e.outdoor)?(0,Qe.jsx)(Le.CloseGardenButton,{rid:wt,r:It,now:Tt,by:Ht,quiet:!0,short:!0}):null,(0,Qe.jsx)(V.default,{testID:"display-add-soldout",accessibilityRole:"button",accessibilityLabel:"Add sold out, mark a dish sold out or put it back on",onPress:()=>Ms(!0),style:({pressed:e})=>({...Ge.look.quiet(e),flexGrow:1,flexShrink:1,minWidth:0}),children:(0,Qe.jsx)(J.T,{size:15,weight:"semibold",colour:ie.colours.goldLight,style:{textAlign:'center'},children:"Add sold out"})}),k.IS_CAR||k.IS_OWNER_DESKTOP?null:(0,Qe.jsx)(f.GiftQrButton,{rid:wt,venue:It.name})]}),en=Qs.length?(0,Qe.jsxs)(K.default,{testID:"takeaway-panel",style:[Ge.look.panel,{overflow:'hidden'}],children:[(0,Qe.jsxs)(J.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,Qe.jsx)(J.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,Qe.jsxs)(J.T,{size:12,colour:ie.colours.muted,children:[Qs.length," live"]})]}),(0,Qe.jsx)(K.default,{style:{padding:10},children:(0,Qe.jsx)(rt,{list:Qs,me:Ht,compact:!0,bookings:Dt})})]}):null,tn=(Ne.DueToday,It.settings.turnMins||90),sn=cl?gl:(0,v.todaysGuestList)(qs,Tt,tn),ln=cl?[]:(0,v.todaysFinishedList)(qs,Tt,tn),nn=cl?hl?`${ul}\u2019s guests`:`Guests ${ul}`:'Today\u2019s guests',on=(0,Qe.jsxs)(Qe.Fragment,{children:[0===sn.length?(0,Qe.jsx)(J.Muted,{children:cl?dl{const t=(0,v.isLeftEarly)(e,Tt,tn),s=(0,ne.isSeatedHighlight)(e.status,{otherDay:cl})&&!t,l=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),seated:s,leftEarly:t,tableWord:!0}),i=ie.colours.text,n=s?ie.colours.goldLight:ie.colours.muted,o=ie.colours.gold,a=l.depositWarn?ie.colours.amber:ie.colours.goldLight;return(0,Qe.jsxs)(V.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:l.a11y,accessibilityHint:cl?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>s?{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,...(0,ne.seatedHighlightStyle)({backgroundColor:e?Xe:Je,borderColor:ie.colours.gold,borderLeftColor:ie.colours.gold,borderBottomWidth:1.5})}:{minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:o,style:{width:58},children:l.time}),(0,Qe.jsx)(J.T,{size:18,weight:"semibold",colour:i,testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l.name}),l.allergy?(0,Qe.jsx)(K.default,{style:{paddingTop:2},children:(0,Qe.jsx)(N.AllergyIcon,{text:l.allergy,size:22,colour:ie.colours.amber,ink:ie.colours.bg,testID:`display-allergy-${e.id}`})}):null,'VIP'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-vip-${e.id}`,size:18,accessibilityLabel:"VIP",children:"\u2605"}):null,'Regular'===l.vip?(0,Qe.jsx)(J.T,{testID:`display-regular-${e.id}`,size:18,accessibilityLabel:"regular",children:"\u2665"}):null,l.occasion&&ce.OCCASION_ICON[l.occasion]?(0,Qe.jsx)(J.T,{testID:`display-occasion-${e.id}`,size:18,accessibilityLabel:l.occasion,children:ce.OCCASION_ICON[l.occasion]}):null]}),(0,Qe.jsxs)(J.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,Qe.jsx)(J.T,{size:16,colour:i,children:l.people}),l.deposit?(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}):null,l.deposit?(0,Qe.jsx)(J.T,{size:16,weight:"semibold",colour:a,style:Y.KEEP_TOGETHER,testID:`display-deposit-${e.id}`,children:l.deposit}):null,(0,Qe.jsx)(J.T,{size:16,colour:n,children:" \xb7 "}),(0,Qe.jsx)(J.T,{size:16,weight:s?'semibold':'regular',colour:'No table yet'===l.table?n:i,children:l.table}),l.dog?(0,Qe.jsx)(J.T,{size:16,children:" "}):null,l.dog?(0,Qe.jsx)(K.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,Qe.jsx)(we.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]}),l.guestChange?(0,Qe.jsx)(J.T,{size:15,colour:ie.colours.amber,testID:`display-guest-change-${e.id}`,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:l.guestChange}):null]},e.id)}),ln.length?(0,Qe.jsxs)(K.default,{testID:"display-finished-section",style:{marginTop:14,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,padding:8,gap:4},children:[(0,Qe.jsxs)(V.default,{testID:"display-finished-toggle",accessibilityRole:"button",accessibilityLabel:`Finished, ${ln.length}${ps?', expanded':', collapsed'}`,accessibilityState:{expanded:ps},onPress:()=>fs(e=>!e),style:({pressed:e})=>({minHeight:48,paddingHorizontal:8,paddingVertical:6,borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'space-between',backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(J.T,{size:16,weight:"semibold",colour:ie.colours.goldLight,children:["Finished (",ln.length,")"]}),(0,Qe.jsx)(J.T,{size:16,colour:ie.colours.muted,children:ps?'\u25be':'\u25b8'})]}),ps?ln.map(e=>{const t=(0,je.guestRowText)(e,{name:e.walkIn?(0,me.privName)(e,Nt):(e.name??'').replace(' (example)',''),finished:!0,tableWord:!0});return(0,Qe.jsxs)(V.default,{testID:`display-finished-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:"Opens the booking",onPress:()=>{ys(!1),ms(e.id)},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:ie.colours.hairline,backgroundColor:e?ie.colours.tilePressed:'transparent'}),children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",colour:ie.colours.gold,style:{width:58},children:t.time}),(0,Qe.jsx)(J.T,{size:17,weight:"semibold",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,Qe.jsxs)(J.T,{size:15,colour:ie.colours.muted,style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[t.people," \xb7 ",t.table]}),(0,Qe.jsx)(K.default,{style:{marginLeft:68,marginTop:4,alignItems:'flex-start'},children:(0,Qe.jsx)(S.BookingUndo,{b:e,rid:wt,today:Mt,who:t.name,allowed:ki.ok})})]},e.id)}):null]}):null,(0,Qe.jsx)(Ee.CancellationsSection,{items:Ml,dayWord:cl?hl?ul.toLowerCase():`on ${ul}`:'today'})]}),an=(0,Qe.jsx)(U.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:on}),rn=F.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&ys(!1)}}),dn=(0,Qe.jsxs)(V.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${nn}, ${sn.length}`,accessibilityState:{expanded:bs},'aria-expanded':bs,dataSet:{centreExempt:'count-and-turned-label-centred-as-a-group'},onPress:()=>ys(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:bs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?ie.colours.tilePressed:bs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,Qe.jsx)(J.T,{size:16,weight:"bold",colour:ie.colours.gold,children:sn.length}),(0,Qe.jsx)(K.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(K.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,Qe.jsxs)(J.T,{size:13,weight:"semibold",colour:ie.colours.goldLight,numberOfLines:1,children:[nn," ",bs?'\u2039':'\u203a']})})})]}),cn=Math.min(560,Math.max(320,.44*dt))<400,un=bs?(0,Qe.jsxs)(K.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,Qe.jsxs)(K.default,{testID:"guests-drawer",...rn.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*dt)),backgroundColor:ie.colours.surface,borderRightWidth:1,borderColor:ie.colours.gold,borderRadius:14,...Ge.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,Qe.jsxs)(K.default,{testID:"guests-head",style:{paddingHorizontal:12,paddingTop:8},children:[(0,Qe.jsxs)(K.default,{testID:"guests-heading-row",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsxs)(K.default,{style:{flex:1,minWidth:0,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,paddingRight:4},children:[(0,Qe.jsxs)(J.T,{testID:"guests-heading",size:cn?14:17,weight:"semibold",colour:ie.colours.gold,style:{flexShrink:1,minWidth:0},children:[nn.toUpperCase()," (",sn.length,")"]}),(0,Qe.jsx)(V.default,{testID:"guest-key-button",accessibilityRole:"button",accessibilityLabel:"Guest key",accessibilityState:{expanded:hs},'aria-expanded':hs,onPress:()=>gs(e=>!e),style:({pressed:e})=>({minHeight:44,paddingHorizontal:cn?8:12,borderRadius:12,borderWidth:1,borderColor:hs?ie.colours.gold:ie.colours.hairline,alignItems:'center',justifyContent:'center',flexShrink:0,backgroundColor:e?ie.colours.tilePressed:hs?ie.colours.goldTint:'rgba(255,255,255,0.03)'}),children:(0,Qe.jsxs)(J.T,{size:14,weight:"semibold",colour:ie.colours.goldLight,children:[cn?'Key':'Guest key'," ",hs?'\u25b4':'\u25be']})})]}),(0,Qe.jsx)(s.GoldClose,{testID:"guests-close",label:`Close ${nn}`,onPress:()=>ys(!1),style:{marginRight:-6,flexShrink:0}})]}),Pl.count?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,testID:"cancelled-day-tally-guests",children:Al}):null,hs?(0,Qe.jsxs)(K.default,{testID:"guest-key",accessible:!0,accessibilityLabel:"Guest key: yellow triangle allergy, gold dog, star VIP, heart regular, cake birthday, heart with ribbon anniversary",style:{marginTop:6,padding:10,borderRadius:12,borderWidth:1,borderColor:ie.colours.hairline,flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8},children:[(0,Qe.jsxs)(K.default,{testID:"guest-key-allergy",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{testID:"guest-key-dog",style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),[['\u2605','VIP'],['\u2665','regular'],['\ud83c\udf82','birthday'],['\ud83d\udc9d','anniversary']].map(([e,t])=>(0,Qe.jsxs)(K.default,{testID:`guest-key-${t}`,style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(J.T,{size:16,children:e}),(0,Qe.jsx)(J.T,{size:14,children:t})]},t))]}):null]}),an]}),(0,Qe.jsx)(V.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${nn}`,accessibilityRole:"button",onPress:()=>ys(!1),style:{flex:1}})]}):null,hn=wl?Il:l.IS_KIRKTON&&!Object.values(It.kitchenHours??{}).some(Boolean)?(0,Qe.jsxs)(K.default,{testID:"kirkton-hours-to-confirm",style:[Ge.look.panel,{padding:14,gap:8}],children:[(0,Qe.jsx)(J.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,Qe.jsx)(J.Muted,{children:"No service hours have been set for this venue."})]}):(0,Qe.jsx)(ze.DayGraph,{busyThreshold:(0,t.venueBusy)(It,Dt,Tt).busy,todays:gl,open:pl,close:fl,now:Tt,turnBase:It.settings.turnMins,blocks:Ol,pauses:ml,compact:ht,dense:!ht,fit:bt,tight:bt&&ut<=600,height:bt?Ci:Si,forecastNote:cl?void 0:Xl,emptyText:kl,past:dl{Ss.current=Date.now(),vs(!0)},shortDay:!ht&&dt<1100}),yn=(0,Qe.jsx)(Me.DisplayCalendar,{visible:Ds,today:Mt,day:dl,bookings:Dt,restaurant:It,now:Tt,onDay:Cs,onClose:()=>vs(!1)}),pn=()=>{cl?ys(!0):Yt(!0)},fn=(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',padding:Pi?4:ut<820?8:12,paddingTop:Pi?vi?2:4:ut<820?vi?4:6:vi?8:10,gap:Pi?8:12,minHeight:0,overflow:'hidden'},children:[At?null:dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[At?null:fi,At?(0,Qe.jsx)(U.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"})}):yi?bi:gi,pi,un]}),(0,Qe.jsxs)(K.default,{testID:"display-side",style:{width:pt,gap:ut<820?4:8,minHeight:0},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexShrink:0,flexWrap:'wrap',flexDirection:'row',gap:8},children:Di(!1)}),(0,Qe.jsx)(K.default,{style:{flexShrink:0},children:Ii}),At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",onLayout:Xi,style:vi&&!Ki?{flexGrow:1,flexShrink:0,minHeight:0}:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:ut<820,snug:ut<820,tight:ut<800,fill:vi&&!Ki,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{ref:$i,testID:"day-graph-slot",onLayout:Xi,style:{flexGrow:0,flexShrink:vi?0:1,flexBasis:(ht?Si:Ci)+(vi?Oi:Mi),height:(ht?Si:Ci)+(vi?Oi:Mi),minHeight:ut<=600?90:Math.min((ht?Si:Ci)+ze.DAY_GRAPH_CHROME,!ht&&ut>=768?140+ze.DAY_GRAPH_CHROME:120),overflow:'visible'},children:gn}),vi&&!At?(0,Qe.jsx)(K.default,{ref:Wi,testID:"display-side-split",onLayout:Xi,style:{flexShrink:0,alignItems:'center'},children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})}):null,(0,Qe.jsxs)(U.default,{testID:"display-side-scroll",style:vi?{flexGrow:0,flexShrink:1,minHeight:zi&&Ni?44:0}:{flexGrow:1,flexShrink:1,flexBasis:44,minHeight:44},contentContainerStyle:{gap:10,paddingBottom:6},onContentSizeChange:(e,t)=>{const s=t>10;s!==Li.current&&(Li.current=s,Hi(s),setTimeout(Xi,0))},children:[vi||ji?null:(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:44,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),en,(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht})]})]})]});return(0,Qe.jsxs)(Q.SafeAreaView,{style:{flex:1,backgroundColor:ie.colours.bg},onTouchStart:()=>{Ss.current=Date.now()},onMouseDown:()=>{Ss.current=Date.now()},children:[ht?(0,Qe.jsx)(K.default,{style:{flex:1},children:(0,Qe.jsxs)(U.default,{ref:ft,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,Qe.jsxs)(K.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12,position:'relative'},children:[e?null:(0,Qe.jsx)(K.default,{style:{position:'absolute',top:4,right:4,zIndex:2},children:(0,Qe.jsx)(j.ExitButton,{})}),(0,Qe.jsx)(ee.RestaurantLogo,{rid:wt,size:64}),(0,Qe.jsx)(J.T,{center:!0,size:24,weight:"bold",accessibilityRole:"header",children:It.name}),(0,Qe.jsx)(ee.PoweredBy,{}),(0,Qe.jsx)(z.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,Qe.jsx)(K.default,{accessible:!0,accessibilityLabel:`Current time ${(0,se.hm)(Tt)}`,children:(0,Qe.jsx)(J.T,{center:!0,size:30,weight:"semibold",colour:ie.colours.goldLight,children:(0,se.hm)(Tt)})}),(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:"m"}),(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",size:"m"}),te]}),Ue,k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt}),bn,(0,Qe.jsx)(K.default,{testID:"phone-glance",style:{width:'100%'},children:(0,Qe.jsx)(ot,{phone:!0,split:Hl,items:[{label:`Tables \xb7 ${ul}`,value:Ll.length,testID:'badge-tables'},{label:`Covers \xb7 ${ul}`,value:zl,testID:'badge-covers'},{label:'Takeaway',value:Qs.length,alert:Qs.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>ns(!0)}]})}),(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{gap:8},children:Di(!0)}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),Ii,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:[yi?bi:gi,pi]}),(0,Qe.jsxs)(K.default,{onLayout:e=>{xt.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[Ge.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,Qe.jsxs)(J.T,{center:!0,size:20,weight:"semibold",colour:ie.colours.goldLight,accessibilityRole:"header",children:[nn," (",sn.length,")"]}),(0,Qe.jsx)(K.default,{testID:"display-guest-list",accessibilityLabel:nn,style:{gap:4},children:on})]}),en,gn,(0,Qe.jsx)(K.default,{testID:"covers-dock",children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,compact:!0,sound:(0,O.flapSoundOn)(),onPress:()=>ft.current?.scrollTo({y:xt.current,animated:!0})})}),(0,Qe.jsxs)(K.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,Qe.jsx)(J.T,{center:!0,size:14,colour:Nt?ie.colours.muted:ie.colours.amber,children:Nt?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,Qe.jsx)(J.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Bs(!0),style:{minHeight:48,alignSelf:'stretch'}}),ji?null:(0,Qe.jsx)(J.Button,{testID:"display-reviews",kind:"secondary",label:"Reviews",accessibilityLabel:"Reviews",onPress:()=>Ls(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Zi]})}):(0,Qe.jsxs)(Qe.Fragment,{children:[vi?(0,Qe.jsx)(K.default,{testID:"display-whos-on-top",style:{flexShrink:0,width:'100%',maxWidth:'100%',flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,minHeight:44,maxHeight:44,overflow:'hidden',backgroundColor:(0,o.soutersSurface)('#0D0D0C'),borderBottomWidth:1,borderBottomColor:ie.colours.hairline},children:(0,Qe.jsx)(K.default,{style:{flex:1,minWidth:0,maxHeight:44,overflow:'hidden',justifyContent:'center'},children:(0,Qe.jsx)(w.WhosOnShift,{compact:!0,marquee:!0})})}):null,(0,Qe.jsxs)(K.default,{testID:"display-header",style:{flexDirection:'row',alignItems:'center',paddingHorizontal:dt>=1e3?18:14,paddingVertical:Pi?2:ut<820?4:8,gap:8,minHeight:Pi&&vi?44:52,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...Ge.look.web({backgroundImage:l.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-left",style:{flex:1,flexDirection:'row',alignItems:'center',gap:vi?16:8,minWidth:0,overflow:'hidden',...vi?{justifyContent:'flex-start'}:null},children:[(0,Qe.jsx)(K.default,{testID:"display-header-brand",style:vi?{flexShrink:1,minWidth:96,maxWidth:280}:{flex:1,flexShrink:1,minWidth:96,maxWidth:280},children:(0,Qe.jsx)(ee.RestaurantBrand,{rid:It.id,size:dt<900?32:40,beside:!0,noLogo:vi})}),(0,Qe.jsxs)(K.default,{testID:"display-header-time",style:{flexDirection:'row',alignItems:'baseline',gap:8,flexShrink:0},children:[(0,Qe.jsx)(J.T,{size:dt<900?18:21,weight:"semibold",colour:ie.colours.goldLight,style:{letterSpacing:.4,lineHeight:26,fontVariant:['tabular-nums']},children:(0,se.hm)(Tt)}),dt>=900?(0,Qe.jsx)(J.T,{size:13,colour:ie.colours.muted,children:(0,se.niceDate)(Tt)}):null]})]}),At?(0,Qe.jsx)(K.default,{style:{width:220}}):(0,Qe.jsx)(K.default,{testID:"display-day-centre",style:{alignItems:'center',justifyContent:'center'},children:bn}),(0,Qe.jsxs)(K.default,{style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'flex-end',gap:8,minWidth:0,flexShrink:0},children:[(0,Qe.jsxs)(K.default,{testID:"display-header-chips",style:{flexDirection:dt>=1400||vi?'row':'column',alignItems:dt>=1400||vi?'center':'flex-end',justifyContent:'center',gap:6,flexShrink:0},children:[(0,Qe.jsx)(Ve.ShellfishChip,{rid:wt,by:Ht,app:"display",size:dt<1240?'xs':dt<1280||ut<700?'s':'m'}),At?null:(0,Qe.jsx)(Ve.SundayRoastChip,{rid:wt,by:Ht,app:"display",slot:vi,size:dt<1340?'xs':dt<1400||ut<700?'s':'m'})]}),'simulated'===Ct?(0,Qe.jsx)(V.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>St(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(J.T,{size:11,colour:ie.colours.muted,children:"+15"})}):null,te,e?null:(0,Qe.jsx)(K.default,{testID:"display-exit-slot",style:{width:44,height:44,flexShrink:0,alignItems:'center',justifyContent:'center'},children:(0,Qe.jsx)(j.ExitButton,{size:44})})]})]}),Ue,k.IS_CAR||!At||vi?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(De.BookingSaveBanner,{rid:wt,margin:{marginHorizontal:12,marginTop:6}}),At||vi?null:(0,Qe.jsx)(K.default,{testID:"display-day-stats",style:et,children:(0,Qe.jsxs)(K.default,{style:tt,children:[k.IS_CAR?null:(0,Qe.jsx)(w.WhosOnShift,{compact:!0}),(0,Qe.jsx)(K.default,{style:st,children:(0,Qe.jsx)(ot,{splitOnly:!0,split:Hl,items:[]})})]})}),bt?fn:(xn=(0,Qe.jsxs)(Qe.Fragment,{children:[(0,Qe.jsxs)(K.default,{testID:"front-door-bar",style:{gap:10},children:[(0,Qe.jsx)(K.default,{testID:"primary-actions",style:{flexWrap:'wrap',flexDirection:'row',gap:12},children:Di(!1)}),Ii]}),(0,Qe.jsx)(Le.BlocksBanner,{rid:wt,now:Tt,big:!0,by:Ht}),At?(0,Qe.jsx)(A.DayView,{rid:wt,day:At,today:Mt,app:"display"}):(0,Qe.jsx)(Qe.Fragment,{children:(0,Qe.jsxs)(K.default,{style:{flexGrow:1,flexShrink:1,flexBasis:0,minHeight:140,flexDirection:'row',gap:10},children:[dn,(0,Qe.jsxs)(K.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[fi,yi?bi:gi,pi,un]})]})}),en,At?null:(0,Qe.jsx)(K.default,{testID:"covers-dock",style:{flexShrink:0},children:(0,Qe.jsx)(M.CoversToday,{rid:wt,day:dl,sound:(0,O.flapSoundOn)(),onPress:pn})}),At?null:(0,Qe.jsx)(K.default,{testID:"day-graph-slot",style:{flexShrink:0,overflow:'visible',minHeight:Si+ze.DAY_GRAPH_CHROME},children:gn})]}),(0,Qe.jsx)(U.default,{testID:"display-wrap-scroll",style:{flex:1,minHeight:0},contentContainerStyle:{flexGrow:1,padding:12,paddingTop:10,gap:10},children:xn})),Zi]}),(0,Qe.jsx)($.SoldOutStrip,{rid:wt,by:Pt,onOpen:()=>Ms(!0)}),(0,Qe.jsx)(B.SoldOutSheet,{visible:Ps,onClose:()=>Ms(!1),rid:wt,by:Pt,hideLinks:!0,testID:"display-soldout-sheet"}),(0,Qe.jsx)(p.TableOrderCue,{rid:wt}),Ot.elements,os?(0,Qe.jsx)(y.EditBookingPicker,{rid:wt,today:Mt,who:Ht,onClose:()=>as(!1)}):null,rs?(0,Qe.jsx)(y.EditBookingSheet,{rid:wt,id:rs,who:Ht,onClose:()=>ds(null)}):null,Xt?(0,Qe.jsx)(Ce.TableSheet,{rid:wt,name:Xt,view:el,plan:Gt,todays:qs,now:Tt,privacy:Nt,turnBase:It.settings.turnMins,onClose:()=>Zt(null),onWalkIn:e=>Ot.openWalkInAt(e),onMove:e=>ts(e),onDetails:Ks}):null,vl?(()=>{const e=Dl[vl],t=e?.dayBookings??[];return(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>{Wl(null),Sl(null)},title:`${(0,d.tableNumbersA11y)(vl)} \xb7 ${hl?ul:(0,Pe.dayLong)(dl)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,Qe.jsxs)(J.T,{size:16,center:!0,colour:ie.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${hl?ul.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${hl?ul.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,me.privName)(e,Nt):lt(e.name);return(0,Qe.jsx)(J.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,ve.tablesWords)((0,de.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{Sl(null),ms(e.id)},style:{minHeight:56}},e.id)}),dl>=Mt?(()=>{const t=e?.table.maxSeats??0,s=Dt.filter(e=>e.date===dl&&!e.walkIn&&!['cancelled','noshow','finished'].includes(e.status)&&!(0,de.tablesOf)(e.table).includes(vl)).sort((e,t)=>e.time.localeCompare(t.time));return s.length?(0,Qe.jsxs)(K.default,{testID:"day-table-put",style:{gap:8,alignItems:'stretch'},children:[(0,Qe.jsxs)(J.T,{size:17,weight:"semibold",center:!0,colour:ie.colours.goldLight,children:["Put a booking on ",(0,d.tableNumbersA11y)(vl)]}),Bl?(0,Qe.jsxs)(K.default,{testID:"day-table-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:Bl.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:ie.colours.amber,backgroundColor:ie.colours.amberBg},children:[(0,Qe.jsx)(J.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:Bl.ask}),(0,Qe.jsxs)(J.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-yes",label:"Use it anyway",disabled:!ki.ok,accessibilityHint:ki.hint,style:{minHeight:56,flexGrow:1},onPress:async()=>{const e=Dt.find(e=>e.id===Bl.id);if(Wl(null),!e)return;const s=lt(e.name);Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns)}}),(0,Qe.jsx)(J.Button,{testID:"day-table-overcap-no",kind:"secondary",label:"Pick another",style:{minHeight:56},onPress:()=>Wl(null)})]})]}):null,Bl?null:s.slice(0,12).map(e=>{const s=lt(e.name),l=e.partySize>t;return(0,Qe.jsx)(J.Button,{kind:"secondary",testID:`day-table-put-${e.id}`,label:`${e.time} \xb7 ${s} \xb7 ${e.partySize} Covers`,sub:l?`Bigger than this table (${t} seats)`:e.table?`Now ${(0,d.tableNumbersA11y)(e.table)}`:'No table yet',disabled:!ki.ok,accessibilityHint:ki.hint,accessibilityLabel:`Put ${s}, ${e.time}, ${e.partySize} Covers, on ${(0,d.tableNumbersA11y)(vl)}${l?`. This table seats ${t}`:''}`,onPress:async()=>{if(!(0,De.guardBookingChange)(Ns,{b:e,tables:[vl]}))return;const l=(0,ve.overCapacityAsk)([vl],t,e.partySize);l?Wl({id:e.id,ask:l}):(Sl(null),await(0,De.saveTablesReported)(wt,e,[vl],s,t,Ns))},style:{minHeight:56}},e.id)})]}):null})():null,(0,Qe.jsx)(J.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>{Wl(null),Sl(null)},style:{minHeight:56}})]})})():null,xs?(()=>{const e=Dt.find(e=>e.id===xs);return e?(0,Qe.jsx)(Ie.GuestActionsSheet,{rid:wt,b:e,name:e.walkIn?(0,me.privName)(e,Nt):lt(e.name),view:el,now:Tt,otherDay:e.date!==Mt,turnBase:It.settings.turnMins,onClose:()=>ms(null),onDetails:Ks,onDone:Ns,onEdit:e=>{ms(null),ds(e.id)},onPickOnPlan:(e,t)=>{ys(!1),Kt('plan'),Jt('all'),ws({id:e.id,tables:t})}}):null})():null,ss?(0,Qe.jsx)(Ce.DetailsPanel,{title:ss.title,onClose:()=>ls(null),children:ss.body}):null,yn,cs?(0,Qe.jsx)(Ce.ServiceSummary,{r:It,todays:qs,orders:kt,waitlistAll:Ts,walkInCount:Rs,onClose:()=>us(!1)}):null,$s?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Bs(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,Qe.jsx)(g.FloorLegend,{}),(0,Qe.jsxs)(K.default,{testID:"colour-key-symbols",style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',columnGap:16,rowGap:8,paddingVertical:4},children:[(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(N.AllergyIcon,{text:"allergy",size:18,colour:ie.colours.amber,ink:ie.colours.bg}),(0,Qe.jsx)(J.T,{size:14,children:"allergy"})]}),(0,Qe.jsxs)(K.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,Qe.jsx)(we.DogIcon,{size:18}),(0,Qe.jsx)(J.T,{size:14,children:"dog"})]}),(0,Qe.jsx)(J.T,{center:!0,size:14,children:"\u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Bs(!1)})]}):null,zs?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Hs(!1),title:"More",maxWidth:480,testID:"display-more-sheet",children:[(0,Qe.jsx)(V.default,{testID:"display-reviews",accessibilityRole:"button",accessibilityLabel:"Reviews",onPress:()=>{Hs(!1),Ls(!0)},style:{minHeight:48,alignItems:'center',justifyContent:'center',borderRadius:12,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:(0,Qe.jsx)(J.T,{center:!0,weight:"semibold",children:"Reviews"})}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Hs(!1)})]}):null,Ws?(0,Qe.jsxs)(J.Sheet,{visible:!0,onClose:()=>Ls(!1),title:"Reviews",maxWidth:640,testID:"display-reviews-sheet",children:[(0,Qe.jsx)(X.ReviewsSection,{rid:wt,mode:"read",venueName:It.name}),(0,Qe.jsx)(J.Button,{kind:"secondary",label:"Close",onPress:()=>Ls(!1)})]}):null,is?(0,Qe.jsxs)(Ce.DetailsPanel,{title:"Takeaway",onClose:()=>ns(!1),children:[(0,Qe.jsx)(J.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,Qe.jsx)(rt,{list:Qs,me:Ht,bookings:Dt})]}):null,_s?(0,Qe.jsx)(K.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:ie.colours.bg},children:(0,Qe.jsx)(be.PlanDesigner,{initial:Gt,venue:It.name,mode:"display",startStep:"arrange",onActivity:()=>{Fs.current=Date.now(),null!==Vs&&Us(null)},notice:null!==Vs?`Locking again in ${Vs} s \xb7 touch to keep editing`:null,onSave:e=>{de.useFloor.getState().setPlan(wt,e),Gs(null),Ns('Table plan saved for every screen. Editing is locked again.')},onLiveChange:e=>{de.useFloor.getState().setPlan(wt,e),Ns('Live seating plan updated on every screen.')},onCancel:()=>{Gs(null),Ns('No changes kept. Editing is locked again.')}},_s.at)}):null,e?null:(0,Qe.jsx)(fe.Screensaver,{rid:wt,idleMins:Et.idleMins,pinOn:Et.pinOn,wake:Et,tonightCards:Et.tonightCards,cfg:_t}),e?null:(0,Qe.jsx)(Re.PrintHost,{rid:wt}),e?null:(0,Qe.jsx)(Te.AlertHost,{variant:"display",rid:wt,skipTakeaway:!0}),e?null:(0,Qe.jsx)(E.SeatAllergenReminder,{rid:wt}),e?null:(0,Qe.jsx)($e.TakeawayTakeover,{rid:wt,me:Ht})]});var xn}function ct({rid:e,id:t,turnBase:s}){const l=(0,le.useBookings)(e).find(e=>e.id===t);return l?(0,Qe.jsx)(b.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},1334,[1053,779,805,806,1335,813,1336,1094,843,1140,1337,1338,1339,1091,1122,1340,1341,1346,1347,1204,1348,856,1353,1354,1355,1115,1113,920,1356,1153,891,1104,1357,17,1072,1179,1018,1087,1358,21,378,363,385,278,85,409,1359,19,777,1231,1235,857,845,863,858,804,1090,876,1098,1057,998,1076,1109,1360,1108,1361,1367,1369,1373,1378,1372,1379,1382,1383,1117,1095,1096,862,1388,1220,1389,1230,1222,995,1394,1399,1400,1054,1052,1119,1402,1403,1404,1071,1172,1405,1171,1162,853,1349,1406,8]); __d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return u!!t.walkIn||'walk-in'===t.source},1337,[]); @@ -1439,150 +1439,151 @@ __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,"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},1356,[813,812,17,219,385,278,85,777,1153,858,891,816,893,894,856,892,804,8]); __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])},1357,[813,17,85,804,777,8]); __d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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])},1358,[17,85,780,804,8]); -__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},1359,[]); -__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1360,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1361,1363,1362,998,876,1108,1364,899,856,8]); -__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1361,[813,843,17,1362,85,842,804,777,1109,1363,1110,8]); -__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},1362,[842]); -__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1363,[1362,842]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1364,[17,368,278,85,842,982,1365,804,779,812,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1365,[982,993,856,928,899]); -__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])},1366,[17,219,385,85,804,777,1172,1367,8]); -__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},1367,[]); -__d(function(_g,_r,_i,_a,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 k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:'Deposit paid'===(0,b.depositShort)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1368,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1369,841,863,1096,1370,804,777,1371,8]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1369,[]); -__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},1370,[]); -__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)},1371,[]); -__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1372,[805,813,17,266,319,219,385,85,409,804,857,1373,777,999,916,1346,1375,880,1376,1377,858,863,8,260]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1373,[17,219,85,1374,8]); -__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1374,[]); -__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||'')}},1375,[219]); -__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1377,[17,831,928,899,1376]); -__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=$,e.guestRowText=function(n,l){const p=n.partySize,b=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${b?` (${b} ${1===b?'child':'children'})`:''}`,h=(0,s.tablesOf)(n.table??void 0),f=h.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',y=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',w=$(n),x=h.length?`table${h.length>1?'s':''} ${u(h.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',D=!!n.dog,m=(0,o.allergyLine)(n),k=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,v=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),P=(0,d.guestChangeLine)(n),I=[n.time,l.name,m?`allergy noted: ${m}`:'','VIP'===k?'VIP':'Regular'===k?'regular':'',v??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',w?.spoken??'',x,D?'dog':''].filter(Boolean).join(', ')+'.'+(P?` ${P}`:'');return{time:n.time,name:l.name,people:c,deposit:w?.text??null,depositWarn:!!w?.warn,table:y,dog:D,allergy:m,vip:k,occasion:v,guestChange:P,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function $(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!s.label.startsWith('Deposit paid')){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const $=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.label);return $?{text:`Deposit paid ${t?'about ':''}${$[0]}`,spoken:`deposit ${t?'about ':''}${$[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:$?{text:`Deposit ${$[0]} not paid`,spoken:`deposit ${$[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},1378,[843,841,998,1379,1380]); -__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])},1379,[845]); -__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1380,[]); -__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])},1381,[17,85,780,804,8]); -__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:W,now:H,onClose:T,onDetails:E,onDone:F,otherDay:_,turnBase:O=90,onPickOnPlan:R,onEdit:U}){const[M,G]=(0,n.useState)(null),[Y,q]=(0,n.useState)(!1),[J,K]=(0,n.useState)(null),[Q,V]=(0,n.useState)(!1),X=(0,$.useBookingWrite)(),[Z,ee]=(0,n.useState)(!1),[te,se]=(0,n.useState)(!1),[ae,ie]=(0,n.useState)(!1),le=(0,k.guestRowText)(N,{name:A,seated:'seated'===N.status&&!_}),ne='seated'===N.status&&!_,oe=N.table?ne?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):ne?'Seated':'No table yet',de=_?[]:(0,g.guestActions)(N,A,W,H).filter(e=>'details'!==e.id),re=(0,h.tableActions)(N,A),ce={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},be=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await y.repo.bookings.update(N.id,{table:t}),await(0,u.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,g.tableWords)(t)}\u2026`),T(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,g.tableWords)(t)}.`,`${A} at ${(0,g.tableWords)(t)}`,F)},ue=async e=>{!(0,w.needsEarlySeatConfirm)(N,H)||J?await be(e):K({go:()=>be(e)})},ye=async t=>{if('seat'===t.id&&t.table)return ue(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return T(),E(N);if('finished'===t.id){if(!X.ok)return;return Q?(V(!1),'seated'===N.status?await(0,B.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,B.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),T()):void V(!0)}return'noshow'===t.id?(await y.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),T()):void 0},ge=Y?(0,g.freeTablesNow)(W,N.partySize,!0).slice(0,12):[];if(Z)return(0,P.jsx)(f.TablePicker,{rid:e,booking:N,name:A,turnBase:O,onClose:T,onSaved:F,onPickOnPlan:R?e=>{T(),R(N,e)}:void 0});if(te)return(0,P.jsx)(x.CancelWalkInConfirm,{rid:e,b:N,onClose:T,onDone:F});if(ae)return(0,P.jsx)(j.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:T,onDone:F});const ke=[...de];return(0,P.jsxs)(b.Sheet,{visible:!0,onClose:T,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,P.jsx)(a.BookingNotSavedLine,{b:N}),(0,P.jsx)(c.default,{accessible:!0,accessibilityLabel:le.a11y,testID:"guest-actions-summary",children:(0,P.jsxs)(b.T,{size:18,children:[le.people,le.deposit?(0,P.jsxs)(b.T,{size:18,weight:"semibold",colour:le.depositWarn?S.colours.amber:S.colours.goldLight,children:[" \xb7 ",le.deposit]}):null," \xb7 ",oe]})}),(0,P.jsx)(t.ShowNumberButton,{b:N}),J?(0,P.jsx)(v.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;K(null),e()},onNo:()=>K(null)}):null,Q?(0,P.jsx)(B.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:H,seated:'seated'===N.status}),onNo:()=>V(!1),onYes:()=>{ye({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||_?null:(0,P.jsx)(c.default,{style:{alignItems:'center'},children:(0,P.jsx)(D.BookingUndo,{b:N,rid:e,today:(0,p.ymd)(H),who:A,allowed:X.ok})}),(0,P.jsxs)(c.default,{style:{gap:10},children:[ke.map(e=>(0,P.jsxs)(o.default.Fragment,{children:[(0,P.jsx)(b.Button,{kind:z(e),label:e.label,accessibilityLabel:e.a11y,accessibilityHint:'details'===e.id?void 0:X.hint,disabled:'details'!==e.id&&!X.ok,testID:`guest-act-${e.id}`,onPress:()=>ye(e),style:L}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,P.jsxs)(b.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&Y?(0,P.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ge.length?(0,P.jsx)(b.Muted,{children:"No free tables right now."}):null,M?(0,P.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:S.colours.amber,backgroundColor:S.colours.amberBg},children:[(0,P.jsx)(b.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,P.jsx)(b.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!X.ok,accessibilityHint:X.hint,onPress:()=>{const e=M.table;G(null),ue(e)},style:L}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>G(null),style:L})]}):ge.map(e=>(0,P.jsx)(b.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,h.overCapacityAsk)([e.table],e.seats,N.partySize);t?G({table:e.table,ask:t}):ue(e.table)},style:L},e.table))]}):null]},e.id)),re.map(t=>(0,P.jsx)(b.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:X.hint,disabled:!X.ok,testID:`guest-act-${t.id}`,style:L,onPress:async()=>{if(X.ok)return'assign'===t.id?ee(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(T(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!_&&(0,x.canCancelWalkIn)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelwalkin",onPress:()=>se(!0),style:L}):null,(0,C.canCancelBooking)(N)?(0,P.jsx)(b.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-cancelbooking",onPress:()=>ie(!0),style:L}):null,!U||N.walkIn||['cancelled','noshow'].includes(N.status)||_&&!(N.date>=(0,p.ymd)(H))?null:(0,P.jsx)(b.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:X.hint,disabled:!X.ok,testID:"guest-act-edit",onPress:()=>{T(),U(N)},style:L}),(0,P.jsx)(b.Button,{kind:"ghost",label:ce.label,accessibilityLabel:ce.a11y,testID:"guest-act-details",onPress:()=>ye(ce),style:L})]}),(0,P.jsx)(b.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:T,style:L})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),I=r(d[23]),P=r(d[24]);const L={minHeight:64},z=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1382,[1383,843,1095,998,17,85,777,1098,858,1116,1378,1096,863,1093,1117,1118,1119,804,1338,1385,1386,1115,1355,1113,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1383,[17,362,385,85,858,920,876,996,1384,856,804,777,8]); -__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1384,[]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1387,[1172,1383,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1371,858,998,845,1089,1076,1316,804,1338,1385,1386,1115,1113,8]); -__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1388,[812,17,219,385,85,777,858,998,1389,804,1390,1392,8]); -__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))},1389,[]); -__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)}},1390,[831,858,998,1389,1391,1392]); -__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`},1391,[843]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1392,[219,1391]); -__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1393,[843,17,1183,1172,385,85,995,998,862,863,804,777,1394,1397,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1394,[1395,854,843,17,264,378,385,278,85,858,995,998,1396,863,804,1026,777,1397,1350,899,1338,8]); -__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1395,[]); -__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)}},1396,[862,863,861]); -__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')},1397,[805,998,928,899]); -__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1399,[]); -__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},1400,[1076]); -__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1401,[843,1379]); -__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1402,[17,385,85,777,1401,804,1358,8]); -__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]},1403,[17,85,884,777,1172,863,804,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1404,[17,1172,385,85,409,777,8]); -__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()}}},1405,[17,1005,876,926,816,1006,916,1350,1066]); -__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1406,[805,813,857,17,219,385,85,409,899,804,777,1346,1407,8]); -__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}})()},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 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]})}},1408,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KEEP_TOGETHER",{enumerable:!0,get:function(){return t}}),r(d[0]);const t={display:'inline-block',maxWidth:'100%'}},1359,[219]); +__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},1360,[]); +__d(function(g,r,_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=z,_e.PlanDesigner=function(e){const[a,l]=(0,i.useReducer)(D,{past:[],now:e.initial,future:[]}),F=a.now,E=e=>l({t:'set',p:e}),[O,_]=(0,i.useState)(e.startStep??'areas'),[G,X]=(0,i.useState)(e.initial.areas[0]?.id??''),[K,J]=(0,i.useState)(null),q=(0,C.useOwner)(e=>e.site),V=(0,w.useFloor)(e=>e.settings[q]),Y=!1!==V?.gridSnap,Z=(0,y.gridOf)(V?.gridSize),Q=e=>w.useFloor.getState().setSettings(q,{...w.DEFAULT_SETTINGS,...V??{},gridSnap:e}),[ee,te]=(0,i.useState)(null),[se,ae]=(0,i.useState)(null),[le,oe]=(0,i.useState)(null),re=(0,I.useSync)(e=>e.venueId),ne=e.role??'staff',[ie,de]=(0,i.useState)(''),{width:ue,height:ce}=(0,c.default)(),he=ue>=900,be=a.past.length>0||JSON.stringify(F)!==JSON.stringify(e.initial),ge=(0,b.planCounts)(F);(0,i.useEffect)(()=>{F.areas.some(e=>e.id===G)||X(F.areas[0]?.id??'')},[F.areas,G]),(0,i.useEffect)(()=>{ie&&((0,n.notify)({id:`plan-note:${Date.now()}`,title:ie,timeoutMs:3500,testID:'plan-toast'}),de(''))},[ie]);const pe='table'===K?.kind?F.tables.find(e=>e.id===K.id):void 0,xe='fixture'===K?.kind?(F.fixtures??[]).find(e=>e.id===K.id):void 0,me=(e,t)=>{const s=F.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?F.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):F.joins,l=s&&t.name&&t.name!==s.name?F.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):F.areas;E({...F,areas:l,joins:a,tables:F.tables.map(s=>s.id===e?{...s,...t}:s)})},fe=e=>{const t=F.tables.find(t=>t.id===e);E({...F,tables:F.tables.filter(t=>t.id!==e),joins:F.joins.filter(e=>!t||!e.tables.includes(t.name))}),J(null)},je=e=>{const t=b.FIXTURES.find(t=>t.id===e),s={id:(0,b.fid)('fx'),areaId:G,kind:e,x:25*Math.round((b.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};E({...F,fixtures:[...F.fixtures??[],s]}),J({kind:'fixture',id:s.id})},ye=e=>{const t=(0,y.tidyArea)(F,e,Z),s=(0,y.movedCount)(F,t);s?(E(t),de(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):de('Already tidy: every table is on the grid and lined up.')},we=e=>{const t=(0,b.autoArrange)(F.tables.filter(t=>t.areaId===e),M(F,e));E({...F,tables:[...F.tables.filter(t=>t.areaId!==e),...t]}),de('Layout tidied. Undo if you preferred it before.')};(0,i.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 l({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void l({t:'redo'});if('arrange'!==O||!K)return;const s=e.altKey?1:Y?Z:5,a={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];a&&(e.preventDefault(),Ce(K.kind,K.id,a[0],a[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===K.kind?fe(K.id):(E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==K.id)}),J(null))),'r'===e.key.toLowerCase()&&Te(K.kind,K.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(b.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(b.PLAN_H-e.h,l?e.y+a:a))});E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},Te=(e,t)=>{E('table'===e?{...F,tables:F.tables.map(e=>e.id===t?(0,b.rotate90)(e):e)}:{...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?(0,b.rotate90)(e):e)})},Se=e=>{if(ee&&'table'===e?.kind&&e.id!==ee){const t=F.tables.find(e=>e.id===ee),s=F.tables.find(t=>t.id===e.id),a=F.joins.find(e=>e.tables.includes(t.name)),l=a?F.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...F.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,b.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,b.numOf)(e)-(0,b.numOf)(t))}];return E({...F,joins:l}),te(null),de(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void J(e)}te(null),J(e)},Ie='display'===e.mode;return(0,k.jsxs)(h.default,{testID:"plan-designer",style:{flex:1,backgroundColor:p.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[Ie?(0,k.jsxs)(h.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:p.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,k.jsx)(x.T,{size:18,weight:"bold",colour:p.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,k.jsx)(x.T,{size:14,weight:"medium",colour:p.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,k.jsx)(h.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,k.jsx)(x.T,{size:13,weight:"semibold",colour:p.colours.amber,children:e.notice})}):null]}):null,(0,k.jsxs)(h.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:[(0,k.jsxs)(h.default,{style:{marginRight:6},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Table plan"}),(0,k.jsx)(x.Muted,{size:12,children:e.venue})]}),(0,k.jsx)(x.Row,{gap:6,children:R.map(e=>{const t=e.id===O;return(0,k.jsxs)(d.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{_(e.id),J(null),te(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?p.colours.gold:p.colours.border,backgroundColor:t?p.colours.goldTint:'transparent'},children:[(0,k.jsx)(h.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?p.colours.gold:p.colours.surface2},children:(0,k.jsx)(x.T,{size:13,weight:"bold",colour:t?p.colours.onGold:p.colours.muted,children:e.n})}),(0,k.jsx)(x.T,{weight:"semibold",size:15,colour:t?p.colours.goldLight:p.colours.text,children:e.label})]},e.id)})}),(0,k.jsx)(h.default,{style:{flex:1}}),(0,k.jsxs)(h.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,k.jsxs)(x.T,{weight:"bold",size:16,children:[ge.tables," tables \xb7 ",ge.seats," seats"]}),(0,k.jsxs)(x.Muted,{size:12,children:[F.areas.length," area",1===F.areas.length?'':'s',be?' \xb7 unsaved changes':'']})]}),(0,k.jsx)(B,{label:"Undo",glyph:"\u21b6",disabled:!a.past.length,onPress:()=>l({t:'undo'})}),(0,k.jsx)(B,{label:"Redo",glyph:"\u21b7",disabled:!a.future.length,onPress:()=>l({t:'redo'})}),(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>be?ae({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,k.jsx)(x.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!be,onPress:()=>ae({title:'Save changes to the table plan?',body:`${ge.tables} tables \xb7 ${ge.seats} seats across ${F.areas.length} area${1===F.areas.length?'':'s'}. It updates straight away here and on every other screen and phone within a few seconds.`,ok:'Save changes',run:()=>e.onSave(z(F))}),style:{minHeight:44}}),re?(0,k.jsx)(S.NamedPlanButtons,{onSaveAs:()=>oe('save'),onList:()=>oe('list')}):null]}),(0,k.jsxs)(h.default,{style:{flex:1},children:['areas'===O?(0,k.jsx)(N,{plan:F,set:E,confirm:ae,wide:he,next:()=>_('tables'),toast:de}):null,'tables'===O?(0,k.jsx)(W,{plan:F,set:E,area:G,setArea:X,addTables:(e,t)=>{let s={...F,areas:[...F.areas],tables:[...F.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=G;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=A(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,b.newTable)(t.name,e,t.seats,P(s,e)),[d]=(0,b.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,b.autoArrange)(t,M(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&E(s),de(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:fe,patch:me,wide:he,next:()=>_('arrange'),back:()=>_('areas')}):null,'arrange'===O?(()=>{const e=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(L,{plan:F,area:G,onPick:e=>{X(e),J(null),te(null)}}),ee?(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,k.jsxs)(x.T,{colour:p.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,o.tableNumbers)(F.tables.find(e=>e.id===ee)?.name),"."]}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>te(null)})]}):null,(0,k.jsx)(f.DesignerCanvas,{plan:F,areaId:G,sel:K,onSelect:Se,snapOn:Y,grid:Z,joinFrom:ee,fitWidth:!he,onMove:(e,t,s,a)=>Ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=F.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);me(t,{w:l,h:l,x:e.x,y:e.y})}else me(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else E({...F,fixtures:(F.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,k.jsx)(x.Muted,{size:12,testID:"arrange-help",children:(0,f.touchFirst)()?"Tap a table to select it, then drag it or use Move and Size below \xb7 the gold dot resizes \xb7 swipe the empty floor or the page to scroll \xb7 "+(Y?`tables snap to a ${Z} grid`:'snap to grid is off'):`Drag to move \xb7 the gold dot resizes \xb7 ${Y?`tables snap to a ${Z} 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`})]}),t=(0,k.jsx)(k.Fragment,{children:pe?(0,k.jsx)(H,{t:pe,plan:F,patch:e=>me(pe.id,e),rotate:()=>Te('table',pe.id),remove:()=>fe(pe.id),duplicate:()=>{const e=$(F),t={...pe,id:`t-${e}-${(0,b.fid)('d')}`,name:e,label:void 0},[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===pe.areaId),[t],(F.fixtures??[]).filter(e=>e.areaId===pe.areaId));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id}),de(`${(0,o.tableNumbers)(e)} added`)},join:()=>te(pe.id),split:e=>E({...F,joins:F.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,b.placeNew)(F.tables.filter(t=>t.areaId===e),[{...pe,areaId:e,sectionId:P(F,e)}],(F.fixtures??[]).filter(t=>t.areaId===e));E({...F,tables:F.tables.map(e=>e.id===pe.id?t:e)}),X(e)},onDone:()=>J(null),toast:de,nudge:(e,t)=>Ce('table',pe.id,e*Z,t*Z,!0),grow:(e,t)=>{const s=Math.max(j.MIN_TABLE,pe.w+e*Z),a=Math.max(j.MIN_TABLE,pe.h+t*Z);if('round'===pe.shape){const e=Math.max(s,a);me(pe.id,{w:e,h:e,x:pe.x,y:pe.y})}else me(pe.id,{w:s,h:a,shape:s===a?'square':'rect',x:pe.x,y:pe.y})}}):xe?(0,k.jsxs)(h.default,{style:{gap:10},children:[(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:b.FIXTURES.find(e=>e.id===xe.kind)?.label}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>J(null)})]}),(0,k.jsx)(x.Muted,{children:"Drag it into place; the gold dot changes its length. Or use Move and Size."}),(0,k.jsx)(U,{name:b.FIXTURES.find(e=>e.id===xe.kind)?.label??'fixture',w:xe.w,h:xe.h,nudge:(e,t)=>Ce('fixture',xe.id,e*Z,t*Z,!0),grow:(e,t)=>E({...F,fixtures:(F.fixtures??[]).map(s=>s.id===xe.id?{...s,w:Math.max(j.MIN_FIXTURE,s.w+e*Z),h:Math.max(j.MIN_FIXTURE,s.h+t*Z)}:s)})}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(x.Chip,{label:e.label,selected:xe.kind===e.id,onPress:()=>E({...F,fixtures:(F.fixtures??[]).map(t=>t.id===xe.id?{...t,kind:e.id}:t)})},e.id))}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>Te('fixture',xe.id)}),(0,k.jsx)(x.Button,{kind:"danger",label:"Remove",onPress:()=>{E({...F,fixtures:(F.fixtures??[]).filter(e=>e.id!==xe.id)}),J(null)}})]}):(0,k.jsxs)(h.default,{style:{gap:12},children:[(0,k.jsxs)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:["Arrange ",F.areas.find(e=>e.id===G)?.name??'']}),(0,k.jsx)(x.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,k.jsx)(x.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=$(F),t=(0,b.newTable)(e,G,4,P(F,G)),[s]=(0,b.placeNew)(F.tables.filter(e=>e.areaId===G),[t],(F.fixtures??[]).filter(e=>e.areaId===G));E({...F,tables:[...F.tables,s]}),J({kind:'table',id:s.id})}}),(0,k.jsx)(x.T,{weight:"semibold",size:14,colour:p.colours.muted,children:"FIXTURES"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:b.FIXTURES.map(e=>(0,k.jsx)(h.default,{testID:`add-fixture-${e.id}`,children:(0,k.jsx)(x.Chip,{label:e.label,onPress:()=>je(e.id)})},e.id))}),(0,k.jsx)(x.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>ye(G)}),(0,k.jsx)(x.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,k.jsx)(x.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>we(G)}),(0,k.jsx)(x.Toggle,{label:"Snap to grid",value:Y,onChange:Q}),(0,k.jsx)(h.default,{style:{borderTopWidth:1,borderColor:p.colours.border,paddingTop:10,gap:4},children:F.areas.map(e=>{const t=(0,b.planCounts)(F,e.id);return(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(x.T,{size:14,children:[e.name,(0,T.areaMarks)(e)]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})});return he?(0,k.jsxs)(h.default,{style:{flex:1,flexDirection:'row'},children:[(0,k.jsx)(h.default,{style:{flex:1,padding:10,gap:8},children:e}),(0,k.jsx)(u.default,{style:{width:330,flexGrow:0,flexShrink:0,flexBasis:330,borderLeftWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},contentContainerStyle:{padding:14,gap:12},children:t})]}):(0,k.jsxs)(u.default,{testID:"arrange-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:32},keyboardShouldPersistTaps:"handled",children:[(0,k.jsx)(h.default,{style:{padding:10,gap:8},children:e}),(0,k.jsx)(h.default,{style:{padding:14,gap:12,borderTopWidth:1,borderColor:p.colours.border,backgroundColor:p.colours.surface},children:t})]})})():null]}),se?(0,k.jsx)(h.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,k.jsxs)(h.default,{style:{width:'100%',maxWidth:460,backgroundColor:p.colours.surface,borderRadius:16,borderWidth:1,borderColor:p.colours.gold,padding:20,gap:12},children:[(0,k.jsxs)(x.Row,{style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,style:{flex:1,textAlign:'center'},children:se.title}),(0,k.jsx)(s.GoldClose,{onPress:()=>ae(null),label:"Close",testID:"designer-confirm-close"})]}),(0,k.jsx)(x.T,{colour:p.colours.muted,style:{textAlign:'center'},children:se.body}),(0,k.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Keep editing",onPress:()=>ae(null)}),(0,k.jsx)(x.Button,{kind:se.danger?'danger':'primary',label:se.ok,testID:"confirm-ok",onPress:()=>{const e=se;ae(null),e.run()}})]})]})}):null,'save'===le&&re?(0,k.jsx)(S.SaveAsPlanDialog,{venueId:re,plan:z(F),onClose:()=>oe(null),onSaved:()=>oe(null),toast:de}):null,'list'===le&&re?(0,k.jsx)(S.SavedPlansDialog,{venueId:re,mode:e.mode,role:ne,isCar:v.IS_CAR,onClose:()=>oe(null),onLive:t=>{l({t:'reset',p:t}),e.onLiveChange?.(t),oe(null)},toast:de}):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]),i=r(_d[6]);r(_d[7]);var d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=e(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]),C=r(_d[19]),T=r(_d[20]),S=r(_d[21]),I=r(_d[22]),v=r(_d[23]),k=r(_d[24]);const R=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function D(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 z(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 $=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},P=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,M=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const A=(e,t)=>{let s=(0,b.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,b.slug)(t)}-${a++}`;return s};function B({label:e,glyph:t,onPress:a,disabled:l}){return(0,k.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:l,onPress:a,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:l?.35:e?.7:1,paddingHorizontal:8}),children:'cross'===t?(0,k.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:6},children:[(0,k.jsx)(s.GoldX,{size:14}),(0,k.jsx)(x.T,{size:12,colour:p.colours.muted,children:e})]}):(0,k.jsxs)(x.T,{size:18,weight:"bold",colour:p.colours.gold,children:[t,(0,k.jsxs)(x.T,{size:12,colour:p.colours.muted,children:[" ",e]})]})})}function L({plan:e,area:t,onPick:s}){return(0,k.jsx)(u.default,{testID:"arrange-area-pills",horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0,flexShrink:0,minHeight:48},contentContainerStyle:{gap:6,paddingVertical:2,paddingRight:12,alignItems:'center'},children:e.areas.map(a=>{const l=a.id===t,o=(0,b.planCounts)(e,a.id);return(0,k.jsx)(d.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?p.colours.gold:p.colours.border,backgroundColor:l?p.colours.gold:p.colours.surface,justifyContent:'center'},children:(0,k.jsxs)(x.T,{weight:"semibold",size:14,colour:l?p.colours.onGold:p.colours.text,children:[a.name,(0,T.areaMarks)(a)," ",(0,k.jsxs)(x.T,{size:12,colour:l?p.colours.onGold:p.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function N({plan:e,set:t,confirm:s,wide:l,next:n,toast:c}){const[f,j]=(0,i.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 c(`There's already an area called ${s}`);const a=A(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:l?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:l?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"1. Areas"}),(0,k.jsx)(x.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((a,l)=>{const n=(0,b.planCounts)(e,a.id);return(0,k.jsxs)(h.default,{testID:`area-card-${a.id}`,style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,gap:8},children:[(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(E,{value:a.name,onCommit:e=>e&&e!==a.name&&y(a.id,{name:e})}),(0,k.jsx)(x.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,k.jsx)(B,{label:"Up",glyph:"\u2191",disabled:0===l,onPress:()=>w(l,-1)}),(0,k.jsx)(B,{label:"Down",glyph:"\u2193",disabled:l===e.areas.length-1,onPress:()=>w(l,1)})]}),(0,k.jsx)(x.Row,{gap:8,children:(0,k.jsx)(E,{value:a.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(a.label??'')&&y(a.id,{label:e||void 0})})}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Colour"}),F.map(s=>{const l=(a.colour??e.sections.find(e=>e.id===`s-${a.id}`)?.colour)===s;return(0,k.jsx)(d.default,{testID:`area-colour-${a.id}-${s.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${s}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===a.id?{...e,colour:s}:e),sections:e.sections.map(e=>e.id===`s-${a.id}`?{...e,colour:s}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:s,borderWidth:l?3:1,borderColor:l?'#FFFFFF':p.colours.border}},s)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===a.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),s=a.best??[];return t.length?(0,k.jsxs)(h.default,{style:{gap:6},testID:`area-best-${a.id}`,children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Best tables"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.map(e=>(0,k.jsx)(x.Chip,{testID:`area-best-${a.id}-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:s.includes(e.name),onPress:()=>y(a.id,{best:s.includes(e.name)?s.filter(t=>t!==e.name):[...s,e.name]})},e.id))}),(0,k.jsx)(x.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,k.jsxs)(x.Row,{gap:16,wrap:!0,children:[(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!a.dogs,onChange:e=>y(a.id,{dogs:e})})}),(0,k.jsx)(h.default,{style:{minWidth:220,flex:1},children:(0,k.jsx)(x.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!a.outdoor,onChange:e=>y(a.id,{outdoor:e})})}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>s({title:`Remove ${a.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!==a.id),tables:e.tables.filter(e=>e.areaId!==a.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==a.id)})})})]})]},a.id)}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(a.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[x.styles.input,{flex:1,minHeight:48}]}),(0,k.jsx)(x.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,k.jsx)(x.Button,{label:"Next: Tables",onPress:n,testID:"next-tables"})]}),(0,k.jsxs)(h.default,{style:{flex:l?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,k.jsx)(x.T,{weight:"bold",size:18,colour:p.colours.gold,children:"Start from a template"}),(0,k.jsx)(x.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),b.TEMPLATES.map(e=>(0,k.jsxs)(d.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>s({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()),c(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?p.colours.goldTint:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:12,minHeight:56}),children:[(0,k.jsx)(x.T,{weight:"semibold",children:e.name}),(0,k.jsx)(x.Muted,{children:e.sub})]},e.id))]})]})}const F=[...b.SECTION_COLOURS,'#E5736B','#F2F2F2'];function E({value:e,onCommit:t,label:s="Area name",placeholder:l}){const[o,n]=(0,i.useState)(e);return(0,i.useEffect)(()=>n(e),[e]),(0,k.jsx)(a.TextInput,{accessibilityLabel:s,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:n,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[x.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function W({plan:e,set:t,area:s,setArea:l,addTables:n,remove:d,patch:c,wide:f,next:j,back:y}){const[w,C]=(0,i.useState)(''),[T,S]=(0,i.useState)(4),[I,v]=(0,i.useState)(''),[R,D]=(0,i.useState)(!0),z=(0,i.useMemo)(()=>(0,b.parseTableList)(I),[I]),P=e.tables.filter(e=>e.areaId===s).sort(b.byNumber),M=$(e),A=e.areas.find(e=>e.id===s),N=(e,t)=>{const s=(0,b.sizeFor)(t),a=(0,b.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;c(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,k.jsxs)(u.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,k.jsxs)(h.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,children:"2. Tables"}),(0,k.jsx)(L,{plan:e,area:s,onPick:l}),(0,k.jsxs)(x.Muted,{children:[A?`${A.name}${A.dogs?' \xb7 dogs allowed':''}${A.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,k.jsx)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border},children:P.length?P.map((e,t)=>(0,k.jsxs)(x.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:p.colours.border},children:[(0,k.jsxs)(h.default,{style:{width:92},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.goldLight,children:(0,b.tableLabel)(e)}),(0,k.jsxs)(x.Muted,{size:12,children:[(0,b.shapeLabel)(e.shape),(0,b.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,k.jsx)(h.default,{style:{flex:1},children:(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,k.jsx)(x.Muted,{children:"seats"}),(0,k.jsx)(B,{label:"Remove",glyph:"cross",onPress:()=>d(e.id)})]},e.id)):(0,k.jsx)(h.default,{style:{padding:16},children:(0,k.jsx)(x.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,k.jsx)(x.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,k.jsxs)(h.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.gold,padding:14,gap:10},children:[(0,k.jsxs)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:["Add a table to ",A?.name]}),(0,k.jsxs)(x.Row,{gap:10,children:[(0,k.jsxs)(h.default,{style:{width:120},children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Table number"}),(0,k.jsx)(a.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:[x.styles.input,{minHeight:48,fontSize:18}]})]}),(0,k.jsxs)(h.default,{children:[(0,k.jsx)(x.T,{size:13,colour:p.colours.muted,children:"Seats"}),(0,k.jsx)(x.Stepper,{value:T,min:1,max:20,label:"seats",onChange:S})]})]}),(0,k.jsx)(x.Button,{label:`Add ${(0,o.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{n([{name:(w||M).toUpperCase(),seats:T}],!1)&&C('')}})]}),(0,k.jsxs)(h.default,{style:{backgroundColor:p.colours.surface,borderRadius:14,borderWidth:1,borderColor:p.colours.border,padding:14,gap:10},children:[(0,k.jsx)(x.T,{weight:"bold",size:17,colour:p.colours.gold,children:"Or paste a list"}),(0,k.jsx)(x.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,k.jsx)(a.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:v,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[x.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,k.jsxs)(x.T,{size:14,colour:z.items.length?p.colours.ok:p.colours.amber,children:["Found ",z.items.length," table",1===z.items.length?'':'s'," \xb7 ",z.items.reduce((e,t)=>e+t.seats,0)," seats",z.skipped.length?` \xb7 couldn't read: ${z.skipped.slice(0,2).join('; ')}`:'']}):null,(0,k.jsx)(x.Toggle,{label:"Tidy the layout after adding",value:R,onChange:D}),(0,k.jsx)(x.Button,{label:z.items.length?`Add ${z.items.length} tables`:'Add tables',testID:"paste-add",disabled:!z.items.length,onPress:()=>{n(z.items,R)&&v('')}})]})]})]})}function H({t:e,plan:t,patch:s,rotate:n,remove:d,duplicate:u,join:c,split:f,moveArea:j,onDone:y,toast:w,nudge:C,grow:T}){const[S,I]=(0,i.useState)(e.name);(0,i.useEffect)(()=>I(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),R=()=>{const a=S.trim().toUpperCase();if(a&&a!==e.name)return t.tables.some(e=>e.name===a)?(w(`${(0,o.tableNumbers)(a)} already exists`),void I(e.name)):void s({name:a})};return(0,k.jsxs)(h.default,{style:{gap:12},testID:"table-inspector",children:[(0,k.jsx)(l.TableNumberWarning,{plan:t}),(0,k.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(x.T,{weight:"bold",size:20,colour:p.colours.gold,children:(0,b.tableLabel)(e)}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),C&&T?(0,k.jsx)(U,{name:`table ${(0,o.tableNumbers)((0,b.tableLabel)(e))}`,w:e.w,h:e.h,nudge:C,grow:T}):null,(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Number"}),(0,k.jsx)(a.TextInput,{accessibilityLabel:"Table number",value:S,onChangeText:I,onBlur:R,onSubmitEditing:R,style:[x.styles.input,{flex:1,minHeight:44}]})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Seats"}),(0,k.jsx)(x.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>s({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,style:{width:80},children:"Min Covers"}),(0,k.jsx)(x.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum Covers",onChange:e=>s({minSeats:e})})]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(x.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'square',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);s({shape:'round',w:t,h:t})}}),(0,k.jsx)(x.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,b.sizeFor)(Math.max(5,e.maxSeats));s({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,k.jsx)(x.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,b.sizeFor)(e.maxSeats);s({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,b.minFor)(e.maxSeats)})}})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:n,style:{flex:1}}),(0,k.jsx)(x.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsxs)(x.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(o.tableNumbers).join(', ')," \xb7 book as ",(0,k.jsx)(x.T,{weight:"bold",colour:p.colours.goldLight,children:(0,o.tableNumbers)(v.tables.join('+'))})]}),(0,k.jsxs)(x.Row,{gap:8,children:[(0,k.jsx)(x.Button,{small:!0,kind:"secondary",label:"Join another",onPress:c,style:{flex:1}}),(0,k.jsx)(x.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,k.jsx)(x.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:c}),(0,k.jsx)(x.Toggle,{label:"Bookable online",value:e.online,onChange:e=>s({online:e})}),t.areas.length>1?(0,k.jsxs)(h.default,{style:{gap:6},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move to area"}),(0,k.jsx)(x.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,k.jsx)(x.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,k.jsx)(x.Button,{kind:"danger",label:"Remove table",onPress:d})]})}function U({name:e,w:t,h:s,nudge:a,grow:l}){const o=(e,t,s,a)=>(0,k.jsx)(d.default,{testID:`pad-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:a,style:({pressed:e})=>({minWidth:48,minHeight:44,paddingHorizontal:10,borderRadius:10,borderWidth:1.5,borderColor:p.colours.border,alignItems:'center',justifyContent:'center',opacity:e?.7:1}),children:(0,k.jsx)(x.T,{size:16,weight:"bold",colour:p.colours.gold,children:t})},e);return(0,k.jsxs)(h.default,{testID:"move-size-pad",style:{gap:8},children:[(0,k.jsx)(x.T,{size:14,colour:p.colours.muted,children:"Move"}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('left','\u2190',`Move ${e} left`,()=>a(-1,0)),o('up','\u2191',`Move ${e} up`,()=>a(0,-1)),o('down','\u2193',`Move ${e} down`,()=>a(0,1)),o('right','\u2192',`Move ${e} right`,()=>a(1,0))]}),(0,k.jsxs)(x.T,{size:14,colour:p.colours.muted,children:["Size \xb7 ",t," \xd7 ",s]}),(0,k.jsxs)(x.Row,{gap:6,wrap:!0,children:[o('narrower','\u2212 W',`Make ${e} narrower`,()=>l(-1,0)),o('wider','+ W',`Make ${e} wider`,()=>l(1,0)),o('shorter','\u2212 H',`Make ${e} shorter`,()=>l(0,-1)),o('taller','+ H',`Make ${e} taller`,()=>l(0,1))]})]})}},1361,[813,779,812,1094,843,1104,17,219,385,278,409,85,842,804,777,1362,1364,1363,998,876,1108,1365,899,856,8]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"touchFirst",{enumerable:!0,get:function(){return b.touchFirst}}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:x,onSelect:y,onMove:v,onResize:w,snapOn:L,grid:j=l.GRID,joinFrom:z,fitWidth:C=!1}){const[I,S]=(0,n.useState)({w:0,h:0}),M=I.w&&I.h?Math.min(I.w/l.PLAN_W,I.h/l.PLAN_H):0,R=e=>e*M,k=e.tables.filter(e=>e.areaId===p),E=(e.fixtures??[]).filter(e=>e.areaId===p),[A,F]=(0,n.useState)(null),_=[...k,...E].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),$=e=>k.some(t=>t.id===e),N=(t,n,r,i)=>(0,h.resizeBox)({...t,round:$(t.id)&&'round'===k.find(e=>e.id===t.id)?.shape},n,r,{snap:L&&!i,grid:j,min:$(t.id)?h.MIN_TABLE:h.MIN_FIXTURE,selfId:t.id,others:$(t.id)?e.tables.map(e=>({id:e.id,name:(0,o.tableNumbers)((0,l.tableLabel)(e)),w:e.w,h:e.h})):[]}),D=(0,n.useRef)(null),W=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,_,{grid:(0,h.snapStep)(j),snap:L,free:n});let P=[],T=[];const H=(0,n.useRef)(null),B=(0,n.useRef)(0),O=(0,b.touchFirst)(),X=new Set;for(const e of k)for(const t of k)e.id!==t.id&&e.xt.x&&e.yt.y&&X.add(e.id);const Y=e=>{if(A?.id!==e.id||!M)return e;const t=A.dx/M,o=A.dy/M;if('move'===A.kind){const n=W(e,t,o,A.free);return P=n.guides,T=n.spacing,{...e,x:n.x,y:n.y}}return{...e,...N(e,t,o,A.free)}},G=(e,t)=>{return!O||'resize'===t||(o=e.id,x?.id===o);var o},K=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>G(t,o),onResponderTerminationRequest:()=>!H.current?.armed,onResponderGrant:e=>{H.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1,armed:G(t,o)}},onResponderMove:n=>{const r=H.current;if(!r||!r.armed)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,x&&x.id===t.id||y({kind:e,id:t.id}),D.current={id:t.id,dx:i,dy:s,free:g(n)},F({id:t.id,kind:o,dx:i,dy:s,free:g(n)}))},onResponderRelease:n=>{const r=H.current;H.current=null,B.current=Date.now();const i=D.current&&D.current.id===t.id?D.current:null;if(D.current=null,F(null),!r||!r.moved||!M)return void('move'===o&&y({kind:e,id:t.id}));const s=i?i.dx:n.nativeEvent.pageX-r.x,l=i?i.dy:n.nativeEvent.pageY-r.y,a=s/M,u=l/M,c=i?i.free:g(n);if('move'===o){const o=W(t,a,u,c);v(e,t.id,o.x,o.y)}else{const o=N(t,a,u,c);w(e,t.id,o.w,o.h)}},onResponderTerminate:()=>{H.current=null,D.current=null,F(null)},...'move'===o?{onClick:()=>{Date.now()-B.current<700||y({kind:e,id:t.id})}}:null}),U=(e,t)=>G(e,t)?'none':'pan-x pan-y',V=(e,t,o)=>(0,f.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:`Drag to resize, now ${t.w} by ${t.h}`,...K(e,o,'resize'),style:{position:'absolute',left:Math.max(0,Math.min(R(t.x+t.w)-22,R(l.PLAN_W)-44)),top:Math.max(0,Math.min(R(t.y+t.h)-22,R(l.PLAN_H)-44)),width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:U(o,'resize')},children:(0,f.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:a.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),q=j,J=4*j,Q=k.map(e=>({t0:e,t:Y(e)})),Z=E.map(e=>({f0:e,f:Y(e)})),ee=(()=>{if('resize'!==A?.kind||!M)return;const e=k.find(e=>e.id===A.id);return e?N(e,A.dx/M,A.dy/M,A.free).matchId:void 0})();return(0,f.jsx)(s.default,{testID:"designer-canvas",style:C?{alignSelf:'stretch',height:I.w?Math.round(I.w*l.PLAN_H/l.PLAN_W):240}:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>S({w:e.nativeEvent.layout.width,h:C?Math.round(e.nativeEvent.layout.width*l.PLAN_H/l.PLAN_W):e.nativeEvent.layout.height}),children:M?(0,f.jsxs)(s.default,{style:{width:R(l.PLAN_W),height:R(l.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,f.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>y(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:l.PLAN_W/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:R((t+1)*q),top:0,bottom:0,width:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:l.PLAN_H/q-1},(e,t)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:R((t+1)*q),left:0,right:0,height:1,backgroundColor:(t+1)*q%J===0?'#2A251C':'#17150F'}},`h${t}`)),Z.map(({f0:e,f:t})=>{const o='fixture'===x?.kind&&x.id===t.id;return(0,f.jsxs)(r.default.Fragment,{children:[(0,f.jsx)(c.FixtureShape,{f:t,S:R,selected:o}),(0,f.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...K('fixture',e,'move'),style:{position:'absolute',left:R(t.x)-4,top:R(t.y)-4,width:R(t.w)+8,height:R(t.h)+8,zIndex:5,cursor:'grab',touchAction:U(e,'move')}}),o?V('fixture',t,e):null]},t.id)}),e.joins.map(e=>{const t=k.filter(t=>e.tables.includes(t.name)).map(Y);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,l=n.x+n.w/2,a=n.y+n.h/2,u=Math.hypot(l-r,a-i),c=Math.atan2(a-i,l-r);return(0,f.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:R((r+l)/2-u/2),top:R((i+a)/2)-3,width:R(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${c}rad`}],zIndex:6}},e.id)}),Q.map(({t0:e,t:n})=>{const i='table'===x?.kind&&x.id===n.id,h=z===n.id,b=A?.id===n.id,p=(0,l.tableLabel)(n),g=(0,c.fitLabel)(Math.max(12,Math.min(26,R(Math.min(n.w,n.h))/2.6)),p,R(n.w)*('round'===n.shape?.85:1));return(0,f.jsxs)(r.default.Fragment,{children:[(0,c.seatSpots)(n).map((e,o)=>(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:R(n.x+e.x)-Math.max(4,R(7)),top:R(n.y+e.y)-Math.max(4,R(7)),width:Math.max(8,R(14)),height:Math.max(8,R(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,f.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityHint:i?"Selected. Use the Move and Size buttons below the plan":"Double tap to select, then move it with the buttons below the plan",accessibilityState:{selected:i},"aria-selected":i,accessibilityLabel:`Table ${(0,o.tableNumbers)(p)}${p!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,l.shapeLabel)(n.shape).toLowerCase()}${X.has(n.id)?', overlapping another table':''}${i?', selected: use the Move and Size buttons below the plan':', double tap to select'}`,...K('table',e,'move'),style:{position:'absolute',left:R(n.x),top:R(n.y),width:R(n.w),height:R(n.h),zIndex:b?70:10,borderRadius:'round'===n.shape?R(Math.min(n.w,n.h))/2:R(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||h||ee===n.id?3:2,borderStyle:ee===n.id?'dashed':'solid',borderColor:X.has(n.id)?a.colours.red:i?'#FFFFFF':h?a.colours.blue:ee===n.id?a.colours.goldLight:a.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:U(e,'move'),shadowColor:a.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:b?.92:1},children:[(0,f.jsx)(u.T,{weight:"bold",size:g,colour:a.colours.goldLight,center:!0,numberOfLines:1,children:p}),R(n.h)>46?(0,f.jsxs)(u.T,{size:Math.max(10,.5*g),colour:a.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?V('table',n,e):null]},n.id)}),A&&!A.free?P.map((e,t)=>(0,f.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:R(e.at)-.5,top:R(e.from)-8,width:1.5,height:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:R(e.at)-.5,left:R(e.from)-8,height:1.5,width:R(e.to-e.from)+16,backgroundColor:'centre'===e.kind?a.colours.goldLight:a.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?T.map((e,o)=>e.spans.map(([n,r],i)=>(0,f.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:R(n),top:R(e.cross)-10,width:R(r-n),height:20,borderTopWidth:1.5,borderColor:a.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:R(n),left:R(e.cross)-10,height:R(r-n),width:20,borderLeftWidth:1.5,borderColor:a.colours.goldLight,justifyContent:'center'},children:(0,f.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,f.jsx)(u.T,{size:10,colour:a.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,'resize'===A?.kind?(()=>{const e=[...k,...E].find(e=>e.id===A.id);if(!e||!M)return null;const o=N(e,A.dx/M,A.dy/M,A.free);return(0,f.jsx)(s.default,{testID:"resize-size",pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:8,zIndex:78,alignItems:'center'},children:(0,f.jsxs)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:8,paddingHorizontal:12,paddingVertical:4,borderWidth:1,borderColor:o.match?a.colours.goldLight:a.colours.gold,alignItems:'center'},children:[(0,f.jsxs)(u.T,{size:13,weight:"bold",colour:a.colours.goldLight,center:!0,children:[o.w," \xd7 ",o.h]}),o.match?(0,f.jsxs)(u.T,{testID:"resize-match",size:12,colour:a.colours.goldLight,center:!0,children:["Same size as table ",o.match]}):null]})})})():null,A?.free?(0,f.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:a.colours.border},children:(0,f.jsx)(u.T,{size:11,colour:a.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===k.length&&0===E.length?(0,f.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,f.jsx)(u.T,{center:!0,colour:a.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])),l=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]),f=_r(d[11]);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 g=e=>p||!!e.nativeEvent?.altKey},1362,[813,843,17,1363,85,842,804,777,1109,1364,1110,8]); +__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},1363,[842]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_TABLE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_FIXTURE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"SIZE_STEP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MATCH_PULL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"snapStep",{enumerable:!0,get:function(){return d}}),e.resizeBox=function(o,a,c,s){const u=d(s.grid),h=t=>s.snap?(0,n.snapTo)(t,u):Math.round(t),l=t.PLAN_W-o.x,p=t.PLAN_H-o.y,b=o.w+a,M=o.h+c;let w,P,_=(0,t.clamp)(h(b),s.min,l),y=(0,t.clamp)(h(M),s.min,p);if(s.snap){const n=(s.others??[]).filter(n=>n.id!==s.selfId&&n.w<=l&&n.h<=p&&n.w>=s.min&&n.h>=s.min),t=(n,t)=>Math.abs(n-t)<=f;let o=null;for(const a of n)for(const[n,c]of[[a.w,a.h],[a.h,a.w]])if(!(n>l||c>p)&&(t(b,n)||t(_,n))&&(t(M,c)||t(y,c))){const t=Math.abs(b-n)+Math.abs(M-c);(!o||tn.id!==s.selfId&&(n.w===_&&n.h===y||n.w===y&&n.h===_));n&&(w=n.name,P=n.id)}return{w:_,h:y,...w?{match:w,matchId:P}:{}}};var n=r(_d[0]),t=r(_d[1]);const o=50,a=25,c=25,f=15,d=n=>Math.max(n,c)},1364,[1363,842]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SaveAsPlanDialog=function({venueId:e,plan:n,onClose:l,onSaved:s,toast:o}){const[p,h]=(0,t.useState)(''),[j,f]=(0,t.useState)(!1),[w,C]=(0,t.useState)('');return(0,y.jsxs)(v,{title:"Save as new plan",onClose:l,testID:"save-as-plan",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"Give this seating plan a name. The live plan stays as it is until you tap Use this plan."}),(0,y.jsx)(b,{value:p,onChange:e=>{h(e),C('')},testID:"save-as-plan-name"}),w?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:w}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:l}),(0,y.jsx)(x.Button,{label:"Save plan",testID:"save-as-plan-ok",disabled:j,onPress:async()=>{const t=(0,r.validatePlanName)(p);if(t.ok){f(!0),C('');try{const r=await(0,c.saveAsNewPlan)(e,n,t.name);o(`Saved \u201c${r.name}\u201d. The live plan is unchanged until you tap Use this plan.`),s(r.name),l()}catch(e){C((0,c.explainPlanError)(e))}finally{f(!1)}}else C(t.error)}})]})]})},_e.SavedPlansDialog=function({venueId:e,mode:p,role:h,isCar:j,onClose:f,onLive:w,toast:C}){const P=(0,r.canDeleteNamedPlan)(p,h,!!j),[D,S]=(0,t.useState)(null),[I,A]=(0,t.useState)(''),[k,T]=(0,t.useState)(null),[B,L]=(0,t.useState)(''),[R,E]=(0,t.useState)(null),[M,$]=(0,t.useState)(null),[_,z]=(0,t.useState)(!1),H=async()=>{try{S(await(0,c.listSavedPlans)(e)),A('')}catch(e){A((0,c.explainPlanError)(e))}};(0,t.useEffect)(()=>{H()},[e]);const N=async(t,n=!1)=>{if(!t.isActive){z(!0),A('');try{if(!n){const e=await(0,c.previewPlanSwitch)(t.id);if(e.length)return $({plan:t,rows:e}),void z(!1)}await(0,c.setLivePlan)(t.id);const l=(await(0,c.listSavedPlans)(e)).find(e=>e.id===t.id)??t;C(`Live plan is now \u201c${l.name}\u201d. It is on every screen.`),w(l.plan,l.name),$(null)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}},W=async()=>{if(!k)return;const e=(0,r.validatePlanName)(B);if(e.ok){z(!0);try{await(0,c.renameSavedPlan)(k.id,e.name),T(null),await H(),C(`Renamed to \u201c${e.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}else A(e.error)},U=async()=>{if(R){z(!0);try{await(0,c.softDeleteSavedPlan)(R.id),E(null),await H(),C(`Deleted \u201c${R.name}\u201d.`)}catch(e){A((0,c.explainPlanError)(e))}finally{z(!1)}}};if(M)return(0,y.jsxs)(v,{title:"Some bookings use tables this plan does not have",onClose:()=>$(null),testID:"plan-switch-warning",children:[(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:["If you make \u201c",M.plan.name,"\u201d live, these bookings today or coming up sit on table numbers that are not on that plan:"]}),(0,y.jsx)(l.default,{style:{maxHeight:280},contentContainerStyle:{gap:8},children:M.rows.map(e=>(0,y.jsxs)(s.default,{style:{borderWidth:1,borderColor:u.colours.border,borderRadius:12,padding:10},children:[(0,y.jsx)(x.T,{style:{textAlign:'center'},children:e.name}),(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[e.date.split('-').reverse().join('/')," at ",e.time," \xb7 table",1===e.missing.length?'':'s'," ",e.missing.join(', ')," \xb7 ",e.covers," ",1===e.covers?'cover':'covers']})]},e.id))}),(0,y.jsxs)(x.T,{colour:u.colours.muted,size:13,style:{textAlign:'center'},children:[(0,r.formatWarningList)(M.rows).split('\n').length," booking",1===M.rows.length?'':'s'," in all."]}),(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep the live plan",onPress:()=>$(null)}),(0,y.jsx)(x.Button,{label:"Use this plan anyway",testID:"plan-switch-anyway",disabled:_,onPress:()=>N(M.plan,!0)})]})]});if(k)return(0,y.jsxs)(v,{title:"Rename plan",onClose:()=>T(null),testID:"rename-plan",children:[(0,y.jsx)(b,{value:B,onChange:L,testID:"rename-plan-name"}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Cancel",onPress:()=>T(null)}),(0,y.jsx)(x.Button,{label:"Save name",testID:"rename-plan-ok",disabled:_,onPress:W})]})]});if(R)return(0,y.jsxs)(v,{title:"Delete this plan?",onClose:()=>E(null),testID:"delete-plan",children:[(0,y.jsxs)(x.T,{style:{textAlign:'center'},children:["Delete \u201c",R.name,"\u201d? This cannot be undone from this screen. The live plan is not affected."]}),I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsxs)(x.Row,{gap:10,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{kind:"secondary",label:"Keep this plan",onPress:()=>E(null)}),(0,y.jsx)(x.Button,{kind:"danger",label:"Delete plan",testID:"delete-plan-ok",disabled:_,onPress:U})]})]});return(0,y.jsxs)(v,{title:"Saved seating plans",onClose:f,testID:"saved-plans",children:[(0,y.jsx)(x.Muted,{style:{textAlign:'center'},children:"The live plan is the one every screen uses. Use this plan makes a saved plan live on every device."}),null===D?(0,y.jsx)(n.default,{color:u.colours.gold}):null,I?(0,y.jsx)(x.T,{colour:u.colours.red,style:{textAlign:'center'},children:I}):null,(0,y.jsx)(l.default,{style:{maxHeight:420},contentContainerStyle:{gap:10},children:(D??[]).map(e=>{const t=(0,o.planCounts)(e.plan);return(0,y.jsxs)(s.default,{testID:`saved-plan-${e.id}`,style:{borderWidth:1,borderColor:e.isActive?u.colours.gold:u.colours.border,borderRadius:14,padding:12,gap:8,alignItems:'center'},children:[(0,y.jsx)(x.T,{weight:"bold",size:18,style:{textAlign:'center'},children:e.name}),e.isActive?(0,y.jsx)(s.default,{testID:"live-plan-badge",style:{borderWidth:1,borderColor:u.colours.gold,borderRadius:999,paddingHorizontal:10,paddingVertical:2},children:(0,y.jsx)(x.T,{size:13,colour:u.colours.gold,weight:"semibold",children:"Live"})}):null,(0,y.jsxs)(x.Muted,{style:{textAlign:'center'},children:[t.tables," tables \xb7 ",t.seats," seats",e.updatedBy?` \xb7 last saved by ${e.updatedBy}`:'']}),(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[e.isActive?(0,y.jsx)(x.Muted,{children:"This is the live plan"}):(0,y.jsx)(x.Button,{small:!0,label:"Use this plan",testID:`use-plan-${e.id}`,disabled:_,onPress:()=>N(e)}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Rename",testID:`rename-plan-${e.id}`,onPress:()=>{A(''),T(e),L(e.name)}}),P&&!e.isActive?(0,y.jsx)(x.Button,{small:!0,kind:"danger",label:"Delete",testID:`delete-plan-${e.id}`,onPress:()=>{A(''),E(e)}}):null]})]},e.id)})})]})},_e.NamedPlanButtons=function({onSaveAs:e,onList:t}){return(0,y.jsxs)(x.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Saved plans",testID:"open-saved-plans",accessibilityLabel:"Saved seating plans",onPress:t,style:{minHeight:44}}),(0,y.jsx)(x.Button,{small:!0,kind:"secondary",label:"Save as new plan",testID:"open-save-as-plan",accessibilityLabel:"Save as new plan",onPress:e,style:{minHeight:44}})]})};var t=_r(d[0]),n=e(_r(d[1])),l=e(_r(d[2])),s=e(_r(d[3])),o=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),p=_r(d[8]),h=_r(d[9]),x=_r(d[10]),y=_r(d[11]);function v({title:e,onClose:t,testID:n,children:l}){return(0,y.jsx)(s.default,{testID:n,style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16,zIndex:40},children:(0,y.jsxs)(s.default,{style:{width:'100%',maxWidth:520,maxHeight:'92%',backgroundColor:u.colours.surface,borderRadius:16,borderWidth:1,borderColor:u.colours.gold,padding:20,gap:12},accessibilityViewIsModal:!0,children:[(0,y.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,y.jsx)(x.T,{weight:"bold",size:20,colour:u.colours.gold,style:{flex:1,textAlign:'center'},children:e}),(0,y.jsx)(p.GoldClose,{onPress:t,label:"Close",testID:`${n}-close`})]}),l]})})}function b({value:e,onChange:t,testID:n}){return(0,y.jsx)(h.TextInput,{testID:n,value:e,onChangeText:t,placeholder:r.SAVE_AS_PLACEHOLDER,placeholderTextColor:"#7A7468",accessibilityLabel:r.PLAN_NAME_LABEL,autoCapitalize:"words",autoCorrect:!0,maxLength:60,style:{minHeight:48,borderWidth:1,borderColor:u.colours.border,borderRadius:12,paddingHorizontal:14,color:u.colours.text,fontSize:17,textAlign:'center',backgroundColor:u.colours.surface2}})}},1365,[17,368,278,85,842,982,1366,804,779,812,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.listSavedPlans=c,_e.saveAsNewPlan=async function(a,t,r){const o=(0,e.validatePlanName)(r);if(!o.ok)throw new Error(o.error);const u=(0,e.findSavedPlanByName)(await c(a),o.name),p=(0,e.namedPlanWrite)(u,{venueId:a,name:o.name,plan:t,updatedBy:s()}),m=(0,n.getSupabase)().from('table_plans'),f='id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures',{data:y,error:_}='update'===p.kind?await m.update(p.values).eq('id',p.id).is('deleted_at',null).select(f).single():await m.insert(p.values).select(f).single();if(_)throw _;return l(y)},_e.previewPlanSwitch=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('named_plan_switch_preview',{p_id:e});if(t)throw t;return u(a)},_e.setLivePlan=async function(e){const{data:a,error:t}=await(0,n.getSupabase)().rpc('set_live_table_plan',{p_id:e,p_by:s()});if(t)throw t;const r=a??{};return{name:String(r.name||''),warnings:u(r.warnings)}},_e.renameSavedPlan=async function(a,t){const r=(0,e.validatePlanName)(t);if(!r.ok)throw new Error(r.error);const{data:o,error:l}=await(0,n.getSupabase)().rpc('rename_table_plan',{p_id:a,p_name:r.name,p_by:s()});if(l)throw l;return String(o?.name||r.name)},_e.softDeleteSavedPlan=async function(e){const{error:a}=await(0,n.getSupabase)().rpc('soft_delete_table_plan',{p_id:e,p_by:s()});if(a)throw a},_e.explainPlanError=function(e){const a=String(e&&'object'==typeof e&&'message'in e?e.message:e||'');return/duplicate key|unique/i.test(a)?'A plan with that name is already saved.':/not found/i.test(a)?'That seating plan was not found.':/cannot delete/i.test(a)?'A Display or car cannot delete a seating plan.':/only seating plan/i.test(a)?'This is the only seating plan.':/Switch to another/i.test(a)?'Switch to another plan before deleting this one.':/Not allowed/i.test(a)?'You cannot change seating plans with this sign-in.':a||'That didn\u2019t save. Try again.'};var e=_r(d[0]),a=_r(d[1]),t=_r(d[2]),n=_r(d[3]),r=_r(d[4]);const s=()=>(0,a.actorStamp)({isCar:t.IS_CAR,kind:r.useSync.getState().kind,staffRef:r.useSync.getState().staffRef,fallback:'Staff'});function o(e){return{areas:Array.isArray(e.areas)?e.areas:[],tables:Array.isArray(e.tables)?e.tables:[],joins:Array.isArray(e.joins)?e.joins:[],sections:Array.isArray(e.sections)?e.sections:[],fixtures:Array.isArray(e.fixtures)?e.fixtures:[]}}function l(a){return{id:String(a.id),name:String(a.name||e.MAIN_PLAN_NAME),isActive:!0===a.is_active,updatedAt:String(a.updated_at||''),updatedBy:a.updated_by?String(a.updated_by):null,plan:o(a)}}async function c(e){const{data:a,error:t}=await(0,n.getSupabase)().from('table_plans').select('id,name,is_active,updated_at,updated_by,areas,tables,joins,sections,fixtures').eq('venue_id',e).is('deleted_at',null).order('name');if(t)throw t;return(a??[]).map(l).sort((e,a)=>Number(a.isActive)-Number(e.isActive)||e.name.localeCompare(a.name,'en-GB'))}function u(e){return Array.isArray(e)?e.map(e=>({id:String(e.id),name:String(e.name||'Guest'),date:String(e.date||''),time:String(e.time||''),covers:Number(e.covers||0),tables:Array.isArray(e.tables)?e.tables.map(String):[],missing:Array.isArray(e.missing)?e.missing.map(String):[]})):[]}},1366,[982,993,856,928,899]); +__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])},1367,[17,219,385,85,804,777,1172,1368,8]); +__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},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}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"FIT_ROW_MIN",{enumerable:!0,get:function(){return C}}),_e.Timeline=function({plan:e,bookings:S,now:v,privacy:D,onOpen:I,turnBase:E,t0:z,t1:$,height:L,pauses:R,blockedTables:_,hideNow:O,isToday:W,compact:N=!1,fit:B=!1}){const A=(0,o.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,c.tableLabel)(e)})))],[e]),F=S.filter(e=>!['cancelled','noshow','finished'].includes(e.status)),[P,H]=(0,o.useState)(0),Y=B&&!F.some(e=>!e.table)?A.filter(e=>'__none'!==e.key):A,V=B&&P>0?Math.max(C,Math.min(M,Math.floor(P/Math.max(1,Y.length)))):M,U=V<44,G=(0,o.useMemo)(()=>(0,u.clashes)(F,E),[F,E]),X=Math.max(1,Math.ceil(($.getTime()-z.getTime())/9e5)),[q,J]=(0,o.useState)(0),K=Math.max(30,q-T-2),Q=Math.min(X,Math.max(1,Math.floor(K/k))),Z=q>0?Math.max(k,Math.floor(K/Q*100)/100):k,[ee,te]=(0,o.useState)(0),le=Math.max(0,X-Q),ie=Math.max(0,Math.min(le,ee)),oe=(0,f.addMins)(z,15*ie),ne=(0,f.addMins)(oe,15*Q),re=e=>(e.getTime()-oe.getTime())/9e5*Z,[se,ae]=(0,o.useState)(null),de=(0,o.useRef)(null),ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{q<=0||ce.current||(ce.current=!0,te((0,h.timelineNowScrollOffset)({now:v,t0:z,t1:$,slots:Q,lastOffset:le,hideNow:O,isToday:W})))},[z.getTime(),$.getTime(),Q,le,O,W,q]);const[ue,he]=(0,o.useState)(''),[be,me]=(0,o.useState)(null),fe=(0,o.useRef)(null);fe.current=be,(0,o.useEffect)(()=>{if(!be)return;const e=setTimeout(()=>me(null),a.ARM_MS);return()=>clearTimeout(e)},[be]);const ge=be?F.find(e=>e.id===be.id):void 0,pe=(0,o.useRef)(0),xe=(t,l)=>({onClick:()=>{if(Date.now()-pe.current<700)return;const e=(0,a.releaseOn)(fe.current,t.id,!1,Date.now());if(me(e.arm),he(''),'select'===e.action)try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderTerminationRequest:()=>!(0,a.isArmed)(fe.current,t.id,Date.now()),onResponderGrant:e=>{de.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:e=>{if(!de.current||!(0,a.isArmed)(fe.current,t.id,Date.now()))return;const i=e.nativeEvent.pageX-de.current.x,o=e.nativeEvent.pageY-de.current.y;(Math.abs(o)>=6||Math.abs(i)>=6)&&ae({id:t.id,row:l,dy:o})},onResponderRelease:o=>{const r=de.current;de.current=null,ae(null),pe.current=Date.now();const s=o.nativeEvent.pageX-(r?.x??0),c=o.nativeEvent.pageY-(r?.y??0),h=(0,a.releaseOn)(fe.current,t.id,!(Math.abs(s)<6&&Math.abs(c)<6),Date.now());if(me(h.arm),'select'===h.action){he('');try{n.default.announceForAccessibility(a.SELECTED_A11Y)}catch{}return}if('deselect'===h.action)return void he('');if('none'===h.action)return;he('');const b=Y.findIndex(e=>e.key===l),p=Math.max(0,Math.min(Y.length-1,b+Math.round(c/V))),x=(0,g.dragTables)(t.table,l,Y[p].key);if(!x||(0,i.guardBookingChange)(he,{b:t,tables:x.split('+')}))if(x){d.repo.bookings.update(t.id,{table:x,tableSetHere:!0});const l=(0,g.overCapacityAsk)(x.split('+'),(0,g.seatsOf)(e,x.split('+')).total,t.partySize),o=`${(0,j.privName)(t,D)} \u2192 ${(0,g.tablesWords)(x.split('+'))}, still ${(0,f.hm)((0,u.startOf)(t))}${l?` \xb7 ${l.replace(' Use it anyway?','')} Drag back to undo.`:''}`;he(`Saving ${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}\u2026`),(0,i.reportBookingSave)(t.id,o,`${(0,g.tablesWords)(x.split('+'))} for ${(0,j.privName)(t,D)}`,he)}else Math.abs(s)>=6&&Math.abs(c)=600||ue?(0,w.jsx)(s.default,{style:{flex:q>=600?1:void 0,flexBasis:q>=600?void 0:'100%',minWidth:0},children:(0,w.jsx)(y.T,{size:13,center:q<600,colour:x.colours.muted,numberOfLines:q>=600?1:2,testID:"timeline-hint",children:ue||a.SELECT_HINT})}):null,R?.length?(0,w.jsxs)(y.Row,{gap:4,children:[(0,w.jsx)(s.default,{style:{width:14,height:14,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:13,children:"Blocked"})]}):null,(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.goldLight,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))})}),(0,w.jsx)(s.default,{style:{flexShrink:0},children:(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[N?(0,w.jsxs)(s.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,w.jsx)(s.default,{style:{alignSelf:'center'},children:(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'})}),(0,w.jsx)(y.Muted,{center:!0,testID:"timeline-hint",children:a.SELECT_HINT}),(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:"Use Earlier times and Later times for the rest of service"}),ue?(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{center:!0,size:14,colour:x.colours.goldLight,children:ue})}):null]}):(0,w.jsxs)(y.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(y.Row,{gap:8,children:[(0,w.jsx)(y.Badge,{kind:G.size?'red':'ok',label:G.size?`${G.size} bookings clash`:'No clashes'}),(0,w.jsx)(s.default,{style:{flex:1,minWidth:0},children:(0,w.jsx)(y.Muted,{testID:"timeline-hint",children:a.SELECT_HINT})})]}),(0,w.jsx)(s.default,{testID:"clash-count",accessibilityLabel:`clashes ${G.size}`,children:(0,w.jsx)(y.T,{size:13,colour:x.colours.goldLight,children:ue})})]}),(0,w.jsxs)(y.T,{center:!0,testID:"timeline-window",children:[(0,f.hm)(oe)," to ",(0,f.hm)(ne)]}),X>Q?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-earlier",label:"Earlier times",disabled:0===ie,onPress:()=>te(Math.max(0,ie-Q))}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-later",label:"Later times",disabled:ie>=le,onPress:()=>te(Math.min(le,ie+Q))})]}):null,R?.length?(0,w.jsxs)(y.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(s.default,{style:{width:16,height:16,backgroundColor:'rgba(255,181,71,0.4)',borderRadius:3}}),(0,w.jsx)(y.T,{size:14,children:"Blocked"})]}):null]}),(0,w.jsxs)(s.default,{testID:"timeline-grid",onLayout:e=>{const t=e.nativeEvent.layout.width;Math.abs(t-q)>1&&J(t)},style:{flex:L?void 0:1,height:L,flexShrink:N?0:void 0,flexDirection:'column',borderRadius:14,borderWidth:1,borderColor:x.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:[(0,w.jsxs)(s.default,{testID:"timeline-time-header",style:{flexDirection:'row',height:38,flexShrink:0,borderBottomWidth:1,borderColor:x.colours.border,backgroundColor:(0,t.soutersSurface)('#0F0E0C'),zIndex:40},children:[(0,w.jsx)(s.default,{testID:"timeline-table-head",style:{width:T,justifyContent:'center',paddingLeft:8,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:(0,w.jsx)(y.T,{size:13,weight:"semibold",colour:x.colours.goldLight,children:"Table"})}),(0,w.jsxs)(s.default,{style:{width:Q*Z,flexShrink:0},children:[Array.from({length:Math.ceil(Q/4)},(e,t)=>(0,w.jsx)(s.default,{testID:"tl-time",pointerEvents:"none",style:{position:'absolute',left:4*t*Z,top:26,bottom:0,width:1,backgroundColor:x.colours.border}},t)),Array.from({length:Math.ceil(Q/4)},(e,t)=>{const l=4*t*Z,i=Math.max(0,Math.min(Q*Z-56,l-28));return(0,w.jsx)(s.default,{testID:"tl-time-label",dataSet:{x:String(l)},pointerEvents:"none",style:{position:'absolute',left:i,width:56,top:4,height:22,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:15,weight:"semibold",colour:x.colours.goldLight,center:!0,numberOfLines:1,children:(0,f.hm)((0,f.addMins)(oe,60*t))})},`l${t}`)})]})]}),(0,w.jsxs)(r.default,{testID:"timeline-scroll",onLayout:e=>{const t=e.nativeEvent.layout.height;Math.abs(t-P)>1&&H(t)},style:{flex:1},contentContainerStyle:{flexDirection:'row',width:'100%'},children:[(0,w.jsx)(s.default,{style:{width:T,borderRightWidth:1,borderColor:x.colours.border,backgroundColor:x.colours.surface},children:Y.map((e,t,l)=>(0,w.jsx)(s.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:V,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&l[t-1].area!==e.area?2:0,borderTopColor:x.colours.gold},children:U?(0,w.jsxs)(s.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6},children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,numberOfLines:1,style:{flexShrink:1},children:e.area.toUpperCase()})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(y.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&l[t-1].area===e.area?null:(0,w.jsx)(y.T,{size:10,colour:x.colours.gold,children:e.area.toUpperCase()})]})},e.key))}),(0,w.jsx)(s.default,{style:{width:Q*Z,flexShrink:0,overflow:'hidden'},onStartShouldSetResponder:()=>!!fe.current,onResponderRelease:()=>{me(null),he('')},children:(0,w.jsxs)(s.default,{style:{width:Q*Z},children:[(R??[]).map((e,t)=>{const l=Math.max(0,re(e.from)),i=Math.min(Q*Z,re(e.to));return i<=l?null:(0,w.jsx)(s.default,{testID:"tl-pause",accessible:!0,accessibilityLabel:`Blocked: ${e.label}, ${(0,f.hm)(e.from)} to ${(0,f.hm)(e.to)}`,pointerEvents:"none",style:{position:'absolute',left:l,width:i-l,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}`)}),Y.map((e,i,o)=>{return(0,w.jsxs)(s.default,{testID:`tl-row-${e.key}`,style:{height:V,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:i>0&&o[i-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(Q/4)},(e,l)=>(0,w.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:4*l*Z,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},l)),_?.includes(e.key)?(0,w.jsx)(s.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,w.jsx)(y.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(n=e.key,F.filter(e=>('__none'===n?!e.table:(0,c.tablesOf)(e.table).includes(n))&&(0,u.startOf)(e)oe)).map(t=>{const i=se?.id===t.id&&se.row===e.key?se:null,o=re((0,u.startOf)(t)),n=Math.max(0,Math.min(Q*Z-44,o)),r=Math.min(Q*Z,re((0,f.addMins)((0,u.startOf)(t),(0,u.durOf)(t,E)))),d=Math.min(Q*Z-n,Math.max(44,r-Math.max(0,o))),c=G.has(t.id),h=be?.id===t.id;return(0,w.jsx)(s.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,j.privName)(t,D)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,f.hm)((0,u.startOf)(t))}, ${(0,u.durOf)(t,E)} min${c?', clash':''}${(0,b.depositView)(t,!0)?`, ${(0,b.depositView)(t,!0).a11y}`:''}${h?`. ${a.SELECTED_A11Y}`:''}`,accessibilityState:{selected:h},accessibilityHint:h?void 0:'Tap to select, then drag to another table',dataSet:{tlSelected:h?'1':'0'},...xe(t,e.key),style:[{position:'absolute',left:n,top:(U?2:4)+(i?i.dy:0),width:d,height:V-(U?4:8),borderRadius:8,backgroundColor:(0,p.blockColour)(t),borderWidth:h?3:c?2.5:1,borderColor:h?x.colours.gold:c?'#FF6B5E':'rgba(0,0,0,0.4)',...h?{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:i?40:h?20:2,opacity:'finished'===t.status?p.FINISHED_OPACITY:1,cursor:h?'ns-resize':'pointer',touchAction:h?'none':'pan-x pan-y'},i?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,w.jsx)(y.T,{size:14,weight:"semibold",colour:(0,p.blockTextColour)(t),numberOfLines:U?1:2,style:{lineHeight:16},children:d<100?U&&d>=70?`${t.partySize} \xb7 ${(0,f.hm)((0,u.startOf)(t))}`:String(t.partySize):(0,w.jsxs)(w.Fragment,{children:[c?'\u26a0 ':'','__none'===e.key||U?'':`${(0,l.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,j.privName)(t,D)," \xb7 ",t.partySize,U?' \xb7 ':'\n',(0,f.hm)((0,u.startOf)(t)),t.allergies.length?' \u26a0':'',(0,b.depositView)(t,!0)?d>=150?` \xb7 ${(0,b.depositView)(t,!0).label}`:(0,b.depositTick)(t)?' \u2713':'':'']})})},t.id)})]},e.key);var n})]})})]}),ye.visible?(0,w.jsx)(s.default,{testID:"now-line",pointerEvents:"none",accessible:!0,accessibilityLabel:`Current time ${ye.label}`,style:{position:'absolute',left:T+Math.max(0,Math.min(Q*Z-2,ye.x)),top:0,bottom:0,width:2,backgroundColor:x.colours.gold,zIndex:50},children:(0,w.jsx)(s.default,{testID:"now-line-pill",style:{position:'absolute',top:8,left:ye.pillLeft-Math.max(0,Math.min(Q*Z-2,ye.x)),width:ye.pillWidth,height:22,backgroundColor:x.colours.gold,borderRadius:6,justifyContent:'center'},children:(0,w.jsx)(y.T,{size:10,weight:"bold",colour:x.colours.onGold,center:!0,numberOfLines:1,children:ye.label})})}):null,ge?(0,w.jsx)(s.default,{pointerEvents:"box-none",style:{position:'absolute',left:0,right:0,bottom:8,alignItems:'center',zIndex:60},children:(0,w.jsxs)(y.Row,{wrap:!0,gap:8,style:{justifyContent:'center',backgroundColor:'rgba(15,14,12,0.94)',borderWidth:1.5,borderColor:x.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:4},children:[(0,w.jsx)(s.default,{testID:"timeline-selected",accessible:!0,accessibilityLiveRegion:"polite",accessibilityLabel:`${(0,j.privName)(ge,D)} ${a.SELECTED_A11Y}`,children:(0,w.jsxs)(y.T,{size:14,weight:"semibold",colour:x.colours.gold,center:!0,children:["Selected: ",(0,j.privName)(ge,D)," \xb7 ",ge.partySize]})}),(0,w.jsx)(y.Button,{small:!0,kind:"secondary",testID:"timeline-open-selected",label:"Open booking",onPress:()=>{me(null),I(ge)}}),(0,w.jsx)(y.Button,{small:!0,kind:"ghost",testID:"timeline-deselect",label:"Deselect",onPress:()=>{me(null),he('')}})]})}):null]})]})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=_r(_d[3]),n=e(_r(_d[4]));_r(_d[5]);var r=e(_r(_d[6])),s=e(_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]),x=_r(_d[17]),y=_r(_d[18]),j=_r(_d[19]),w=_r(_d[20]);const k=30,M=52,C=28,T=120},1369,[813,843,1095,17,264,219,278,85,1111,858,998,1076,1370,841,863,1096,1371,804,777,1372,8]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_TZ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOW_MARKER_TICK_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOW_PILL_W",{enumerable:!0,get:function(){return o}}),e.venueHm=u,e.timelineNowVisible=l,e.timelineNowX=c,e.timelineNowMarker=function(t){const n=Math.max(0,t.slots*t.slotWidth),d=c(t.now,t.windowStart,t.slotWidth),s=l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}),m=n>0&&d>=0&&d<=n,f=s&&m,h=n>0?Math.min(o,n):o,w=Math.max(0,Math.min(Math.max(0,n-h),d-h/2));return{visible:f,x:d,label:u(t.now),pillLeft:w,pillWidth:h}},e.timelineNowScrollOffset=function(t){if(!l({now:t.now,t0:t.t0,t1:t.t1,hideNow:t.hideNow,isToday:t.isToday}))return 0;const n=Math.floor((t.now.getTime()-t.t0.getTime())/9e5)-Math.floor(t.slots/3);return Math.max(0,Math.min(t.lastOffset,n))};const t='Europe/London',n=3e4,o=42;function u(n,o=t){try{const t=n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',hour12:!1,hourCycle:'h23',timeZone:o}).replace('.',':').match(/(\d{1,2}):(\d{2})/);if(t)return`${t[1].padStart(2,'0')}:${t[2]}`}catch{}const u=t=>String(t).padStart(2,'0');return`${u(n.getHours())}:${u(n.getMinutes())}`}function l(t){if(t.hideNow||!1===t.isToday)return!1;const n=t.now.getTime();return n>=t.t0.getTime()&&n<=t.t1.getTime()}function c(t,n,o){return(t.getTime()-n.getTime())/9e5*o}},1370,[]); +__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},1371,[]); +__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)},1372,[]); +__d(function(g,r,_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:o,tonightCards:s,cfg:l=null}){const[a,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!1),[h,f]=(0,i.useState)(''),w=(0,i.useRef)(Date.now()),v=(0,i.useRef)(!1),k=(0,i.useRef)(0);v.current=a,(0,i.useEffect)(()=>(y.useScreensaverAsleep.getState().set(a),()=>y.useScreensaverAsleep.getState().set(!1)),[a]);const E=(0,j.idleMsFor)(l,t);(0,i.useEffect)(()=>z?(0,x.keepFullscreen)():void 0,[]),(0,i.useEffect)(()=>{if(!z)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return v.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),k.current=n+800,v.current=!1,window.__ccWokeAt=n,u(!1),I.current&&d(!0),void(w.current=Date.now())):n{w.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 i=setInterval(()=>{null!==E&&!v.current&&!D.current&&Date.now()-w.current>=E&&(v.current=!0,u(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(i)}},[E]);const I=(0,i.useRef)(n);I.current=n;const D=(0,i.useRef)(c);return D.current=c,(0,i.useEffect)(()=>{if(!z)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{}}},[]),c?(0,S.jsx)(M,{wake:o,entry:h,setEntry:f,onOk:()=>{d(!1),f(''),w.current=Date.now(),o.pinDefault&&(0,p.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)(C,{rid:e,tonightCards:s,cfg:l}):null},_e.SaverLogoPreview=function({rid:e,path:t,size:n}){const[o,s]=(0,i.useState)(null);return(0,i.useEffect)(()=>{let e=!0;if(t)return(0,k.saverPhotoUrl)(t).then(t=>{e&&s(t)}),()=>{e=!1};s(null)},[t]),(0,S.jsx)(_.Provider,{value:o,children:(0,S.jsx)(u.default,{testID:t?'saver-logo-uploaded':'saver-logo-default',style:{minWidth:n,height:n,alignItems:'center',justifyContent:'center'},children:(0,S.jsx)(V,{rid:e,size:n,textSize:14})})})},_e.Saver=C;var t=r(_d[0]),n=r(_d[1]),i=r(_d[2]),o=e(i),s=e(r(_d[3])),l=e(r(_d[4]));r(_d[5]);var a=e(r(_d[6])),u=e(r(_d[7])),c=e(r(_d[8])),d=r(_d[9]),h=r(_d[10]),f=r(_d[11]),w=r(_d[12]),v=r(_d[13]),p=r(_d[14]),y=r(_d[15]),x=r(_d[16]),b=r(_d[17]),j=r(_d[18]),k=r(_d[19]),E=r(_d[20]),I=r(_d[21]),S=r(_d[22]);const z='undefined'!=typeof window;function D(e){if(!z||'undefined'==typeof document)return e;try{const{createPortal:t}=r(_d[23],"react-dom");return t(e,document.body)}catch{return e}}function L(e){const t=(0,c.default)(),[n,o]=(0,i.useState)({width:t.width,height:t.height});return(0,i.useEffect)(()=>{if(!e||!z)return void o({width:t.width,height:t.height});const n=()=>{const e=window.visualViewport,n=Math.max(1,Math.round(e?.width||window.innerWidth||t.width)),i=Math.max(1,Math.round(e?.height||window.innerHeight||t.height));o(e=>e.width===n&&e.height===i?e:{width:n,height:i})};return n(),window.addEventListener('resize',n),window.visualViewport?.addEventListener('resize',n),window.visualViewport?.addEventListener('scroll',n),()=>{window.removeEventListener('resize',n),window.visualViewport?.removeEventListener('resize',n),window.visualViewport?.removeEventListener('scroll',n)}},[e,t.width,t.height]),n}function M({wake:e,entry:t,setEntry:i,onOk:o}){const s=e.pinLen||4,l=n=>{const l=(t+n).slice(0,s);i(l),l.length===s&&((0,v.wakePinMatches)(e,l)?o():setTimeout(()=>i(''),300))};return D((0,S.jsxs)(u.default,{testID:"wake-pin",style:{position:z?'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)(w.T,{size:22,weight:"semibold",colour:d.colours.gold,children:"Enter staff PIN"}),(0,S.jsxs)(w.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,s-t.length))]}),(0,S.jsx)(u.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)(w.T,{size:26,colour:d.colours.gold,children:e})},e))})]}))}const T=e=>'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?d.colours.bg:'#000000',P={candle:'candlelight',logo:'logo',clock:'clock and date',covers:'today\u2019s covers',photos:'photo slideshow',black:'black screen'};function C({rid:e,cfg:t=null,box:n}){const o=L(!n),[l,a]=(0,i.useState)(null),c=n?.width??l?.width??o.width,d=n?.height??l?.height??o.height,h=(0,i.useRef)(new s.default.Value(0)).current;(0,i.useEffect)(()=>{s.default.timing(h,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const[w,v]=(0,i.useState)(()=>new Date);(0,i.useEffect)(()=>{const e=setInterval(()=>v(new Date),15e3);return()=>clearInterval(e)},[]);const p=t?t.style:'still',y=!!t&&(0,j.dimNow)(t,w),[x,b]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=!0;if(t?.logo)return(0,k.saverPhotoUrl)(t.logo).then(t=>{e&&b(t)}),()=>{e=!1};b(null)},[t?.logo]);const E=(0,S.jsx)(_.Provider,{value:x,children:(0,S.jsxs)(s.default.View,{testID:n?"saver-preview-box":"screensaver",accessibilityRole:n?void 0:"button",accessibilityLabel:`Screensaver, ${t?P[t.style]:'logo'}${y?', dimmed for the night':''}. Touch anywhere to wake.`,onLayout:n?void 0:e=>{const{width:t,height:n}=e.nativeEvent.layout;t>=1&&n>=1&&a(e=>e&&e.width===t&&e.height===n?e:{width:t,height:n})},style:{position:n?'relative':z?'fixed':'absolute',left:0,top:0,right:n?void 0:0,bottom:n?void 0:0,width:n?c:void 0,height:n?d:void 0,zIndex:n?0:1e5,backgroundColor:T(e),opacity:h,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:['candle'===p?(0,S.jsx)(f.CandleSaver,{width:c,height:d,logo:t=>(0,S.jsx)(V,{rid:e,size:t})}):'logo'===p?(0,S.jsx)(N,{rid:e,width:c,height:d}):'clock'===p?(0,S.jsx)(R,{rid:e,now:w,width:c,height:d}):'covers'===p?(0,S.jsx)($,{rid:e,now:w,width:c,height:d}):'photos'===p?(0,S.jsx)(O,{rid:e,paths:t?.photos??[],width:c,height:d}):'black'===p?(0,S.jsx)(u.default,{testID:"saver-black"}):(0,S.jsx)(A,{rid:e,width:c,height:d}),y?(0,S.jsx)(u.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]})});return n?E:D(E)}const _=o.default.createContext(null);function V({rid:e,size:t,textSize:n}){const i=(0,h.useBrand)(e),s=h.HERO_LOGOS[e]??i.logo,a=o.default.useContext(_);return a?(0,S.jsx)(l.default,{testID:"saver-custom-logo",source:{uri:a},style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):s?(0,S.jsx)(l.default,{source:s,style:{width:t,height:t},resizeMode:"contain",accessibilityLabel:`${i.name} logo`}):(0,S.jsx)(w.T,{size:n??Math.max(20,t/6),weight:"bold",colour:d.colours.gold,style:{textAlign:'center'},children:i.name})}function A({rid:e,width:t,height:n}){return(0,S.jsx)(u.default,{testID:"saver-still",children:(0,S.jsx)(V,{rid:e,size:.5*Math.min(t,n)})})}function N({rid:e,width:t,height:n}){const o=.34*Math.min(t,n),l=(0,i.useRef)(new s.default.ValueXY({x:0,y:0})).current,[a,u]=(0,i.useState)({w:o,h:o}),c=Math.max(o,a.w),d=Math.max(o,a.h);return(0,i.useEffect)(()=>{const e=Math.max(0,(t-c)/2-12),i=Math.max(0,(n-d)/2-12),o=[{x:-e,y:.6*-i},{x:.7*e,y:-i},{x:e,y:.5*i},{x:.4*-e,y:i},{x:0,y:0}],a=s.default.loop(s.default.sequence(o.map(e=>s.default.timing(l,{toValue:e,duration:12e3,useNativeDriver:!1}))));return a.start(),()=>a.stop()},[t,n,c,d]),(0,S.jsx)(s.default.View,{testID:"saver-logo",onLayout:e=>{const{width:t,height:n}=e.nativeEvent.layout;(Math.abs(t-a.w)>1||Math.abs(n-a.h)>1)&&u({w:t,h:n})},style:{transform:l.getTranslateTransform()},children:(0,S.jsx)(V,{rid:e,size:o})})}function R({rid:e,now:t,width:n,height:i}){const o=Math.min(.22*n,.32*i),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)(u.default,{testID:"saver-clock",style:{alignItems:'center',gap:.12*o},children:[(0,S.jsx)(V,{rid:e,size:.7*o}),(0,S.jsx)(w.T,{size:o,weight:"bold",colour:d.colours.gold,style:{textAlign:'center',lineHeight:1.1*o},children:s}),(0,S.jsx)(w.T,{size:.24*o,style:{textAlign:'center'},children:l})]})}function $({rid:e,now:t,width:n,height:i}){const o=(0,E.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=o.filter(t=>t.restaurantId===e&&t.date===s&&!['cancelled','noshow'].includes(t.status)),c=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),f=Math.min(n/12,i/9);return(0,S.jsxs)(u.default,{testID:"saver-covers",style:{alignItems:'center',gap:.3*f},children:[(0,S.jsx)(V,{rid:e,size:2*f}),(0,S.jsx)(w.T,{size:.5*f,style:{textAlign:'center'},children:"Today"}),(0,S.jsxs)(u.default,{style:{flexDirection:'row',gap:1.4*f,justifyContent:'center'},children:[(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:c}),(0,S.jsx)(w.T,{size:.42*f,children:1===c?'cover':'covers'})]}),(0,S.jsxs)(u.default,{style:{alignItems:'center'},children:[(0,S.jsx)(w.T,{size:1.6*f,weight:"bold",colour:d.colours.gold,children:a.length}),(0,S.jsx)(w.T,{size:.42*f,children:1===a.length?'booking':'bookings'})]})]}),h.length?(0,S.jsxs)(w.T,{size:.4*f,style:{textAlign:'center'},colour:d.colours.muted,children:["Next: ",h.map(e=>`${e.time} \xb7 ${e.partySize}`).join(' ')]}):(0,S.jsx)(w.T,{size:.4*f,colour:d.colours.muted,children:"No more arrivals booked today"})]})}function O({rid:e,paths:t,width:n,height:o}){const[l,a]=(0,i.useState)([]),[c,d]=(0,i.useState)(0),h=(0,i.useRef)(new s.default.Value(1)).current;return(0,i.useEffect)(()=>{let e=!0;return Promise.all(t.map(k.saverPhotoUrl)).then(t=>{e&&a(t.filter(e=>!!e))}),()=>{e=!1}},[t.join('|')]),(0,i.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[c%l.length]},style:{width:n,height:o,opacity:h},resizeMode:"cover",accessibilityLabel:`Photo ${c%l.length+1} of ${l.length}`}):(0,S.jsx)(u.default,{testID:"saver-photos-empty",children:(0,S.jsx)(V,{rid:e,size:.4*Math.min(n,o)})})}},1373,[805,813,17,266,319,219,385,85,409,804,857,1374,777,999,916,1346,1376,880,1377,1378,858,863,8,260]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CANDLE_SPEED",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"candleTime",{enumerable:!0,get:function(){return c}}),_e.CandleSaver=function({width:e,height:u,logo:p}){const b=(0,t.useRef)(null),w=(0,t.useRef)(null),x=(0,t.useRef)(null),y=(0,t.useRef)(null),v=Math.round((0,l.logoSize)(e,u));(0,t.useEffect)(()=>{if(!f||!b.current)return;let e=null,t=0,n=0;const o=performance.now();try{if(e=(0,l.create)({canvas:b.current,canvasFront:w.current,logoEl:x.current,glowEl:y.current,drawLogoOnCanvas:!1,reducedMotion:h(),fps:30}),e.setTime(0),!h()){const l=s=>{s-n>=33.333333333333336&&!document.hidden&&(n=s,e?.setTime(c((s-o)/1e3))),t=requestAnimationFrame(l)};t=requestAnimationFrame(l)}}catch{}return()=>{t&&cancelAnimationFrame(t),e?.destroy()}},[e,u]);const E={position:'absolute',left:'16.5%',top:'16.5%',width:'67%',height:'67%',borderRadius:9999,backgroundColor:'#050506',...f?{boxShadow:'0 0 36px 18px rgba(0,0,0,.72), 0 0 80px 28px rgba(0,0,0,.45)'}:{}},j={position:'absolute',left:0,top:0,width:'100%',height:'100%',pointerEvents:'none'};return(0,s.jsxs)(o.default,{testID:"saver-candle",style:{position:'absolute',left:0,top:0,width:e,height:u,backgroundColor:'#050403',overflow:'hidden'},accessible:!1,children:[f?n.default.createElement('canvas',{ref:b,style:{...j,zIndex:0}}):null,f?(0,s.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:0,top:0,right:0,bottom:0,zIndex:1,backgroundImage:'radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(5,4,3,.3) 80%, rgba(5,4,3,.62) 100%)'}}):null,(0,s.jsxs)(o.default,{ref:x,pointerEvents:"none",style:f?{position:'absolute',left:0,top:0,zIndex:2,width:v,height:v}:{position:'absolute',left:(e-v)/2,top:(u-v)/2,width:v,height:v},children:[f?(0,s.jsx)(o.default,{ref:y,style:{position:'absolute',left:'50%',top:'42%',width:'118%',height:'118%',borderRadius:9999,transform:[{translateX:'-50%'},{translateY:'-50%'}],backgroundImage:'radial-gradient(circle, rgba(255,200,110,.26) 0%, rgba(200,120,40,.08) 42%, transparent 68%)',filter:'blur(10px)'}}):null,(0,s.jsx)(o.default,{style:E}),(0,s.jsx)(o.default,{style:{width:v,height:v,alignItems:'center',justifyContent:'center'},children:p(v)})]}),f?n.default.createElement('canvas',{ref:w,style:{...j,zIndex:3}}):null]})};var t=r(d[0]),n=e(t);r(d[1]);var o=e(r(d[2])),l=r(d[3]),s=r(d[4]);const u=.5,c=e=>e*u,f='undefined'!=typeof document,h=()=>f&&'undefined'!=typeof window&&!!window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches},1374,[17,219,85,1375,8]); +__d(function(_g,_r,_i,_a,m,e,_d){var t,a;t='undefined'!=typeof globalThis?globalThis:this,a=function(){'use strict';var t=60,a=2*Math.PI,r=20261120,n='#050403';function o(t){var a=t>>>0||1;return function(){a=1831565813+(a|=0)|0;var t=Math.imul(a^a>>>15,1|a);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}function i(t,a,r){return a+Math.floor(t()*(r-a+1))}function l(t,a,r){var n=a+2*r;return(t%n+n)%n-r}function h(t,a){if('undefined'==typeof document)throw new Error('Pass options.createCanvas(width, height) when not in a browser');var r=document.createElement('canvas');return r.width=t,r.height=a,r}function s(t,r,n,o){var i=t(r,r),l=i.getContext('2d'),h=r/2,s=Math.max(.08,.35*n),c=l.createRadialGradient(h,h,0,h,h,h),d=(o||[255,226,150])[0],f=(o||[255,226,150])[1],u=(o||[255,226,150])[2];return c.addColorStop(0,'rgba('+d+','+f+','+u+',1)'),c.addColorStop(s,'rgba('+d+','+Math.max(0,f-20)+','+Math.max(0,u-40)+',0.92)'),c.addColorStop(n,'rgba(220,150,50,0.38)'),c.addColorStop(Math.min(.92,n+.35),'rgba(160,90,20,0.08)'),c.addColorStop(1,'rgba(0,0,0,0)'),l.fillStyle=c,l.beginPath(),l.arc(h,h,h,0,a),l.fill(),i}function c(t,r){var n=t(r,r),o=n.getContext('2d'),i=r/2,l=o.createRadialGradient(i,i,0,i,i,i);return l.addColorStop(0,'rgba(255,250,230,1)'),l.addColorStop(.18,'rgba(255,220,140,0.9)'),l.addColorStop(.45,'rgba(232,180,70,0.25)'),l.addColorStop(1,'rgba(0,0,0,0)'),o.fillStyle=l,o.beginPath(),o.arc(i,i,i,0,a),o.fill(),n}function d(t,a){return Math.min(.56*t,.52*a)}function f(r,n,o,i,l){var h=Math.max(28,.04*Math.min(n,o)),s=h,c=h,d=Math.max(0,n-i-2*h),f=Math.max(0,o-l-2*h),u=r%t,p=s+(.5+.5*Math.sin(a*u/60))*d,g=c+(.5+.5*Math.sin(a*u/30-.18))*f;return{x:p,y:g,cx:p+i/2,cy:g+l/2,w:i,h:l}}function u(t,a,r,n,o,i){var l=(t-r)/(.2*o),h=(a-n)/(.22*i),s=Math.sqrt(l*l+h*h);return s>=1?1:s<.4?0:(s-.4)/.6}function p(t){return{far:[s(t,256,.55,[255,220,140]),s(t,224,.62,[255,200,110]),s(t,192,.5,[255,230,160])],mid:[s(t,128,.32,[255,230,160]),s(t,112,.38,[255,210,120]),s(t,96,.28,[255,236,180])],near:[s(t,80,.2,[255,240,190]),s(t,64,.18,[255,224,140]),s(t,48,.16,[255,236,200])],spark:c(t,16),spark2:c(t,10)}}function g(r,n,l,h){var s,c,d,f,u,p,g,w,M,b,x,y,v,S=o(h),C=[];for(s=0;s<96;s++)u=(f=0==(d=(c=Math.pow(S(),.7))<.34?0:c<.7?1:2)?l.far:1===d?l.mid:l.near)[s%f.length],p=0===d?1.1+.9*S():1===d?.9+.7*S():.8+.6*S(),w=r+2*(g=u.width*p),M=n+2*g,b=(0===d?14:1===d?26:40)*(.7+.7*S())*.55,x=Math.max(1,Math.round(b*t/M)),y=S()<.5?-1:1,v=i(S,0===d?3:4,0===d?6:8),C.push({x:S()*r,y:S()*n,z:c,layer:d,front:2===d&&S()<.35,spr:u,size:g,base:0===d?.28+.35*S():.5+.45*S(),ph:S()*a,ph2:S()*a,flickN:i(S,8,14),flickN2:i(S,14,22),rise:x*M/t,ampX:(0===d?36:1===d?54:70)*(.8+.6*S()),ampY:(0===d?16:1===d?24:32)*(.8+.6*S()),spinN:y*v,spinN2:(S()<.5?-1:1)*i(S,2,4),driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(12+10*S())*t/w)),wrapW:w,wrapH:M});C.sort(function(t,a){return t.z-a.z});var N=[];for(s=0;s<140;s++)g=5+10*S(),w=r+24,M=n+24,b=.55*(18+40*S()),x=Math.max(1,Math.round(b*t/M)),N.push({x:S()*r,y:S()*n,spr:S()<.4?l.spark2:l.spark,size:g,base:.35+.65*S(),ph:S()*a,twN:i(S,6,12),rise:x*M/t,driftK:(S()<.5?-1:1)*Math.max(1,Math.round(.55*(16+14*S())*t/w)),amp:8+18*S(),spinN:(S()<.5?-1:1)*i(S,3,6),front:S()<.2,wrapW:w,wrapH:M});return{orbs:C,sparks:N}}function w(r,n,o,i,h,s,c){for(var d,f,p,g,w,M,b,x,y,v,S=(i%t+t)%t,C=h.orbs,N=h.sparks,z=0;z=1e3/c&&(G=t,O(L())),W=requestAnimationFrame(X))}function B(){F=!0,W&&'function'==typeof cancelAnimationFrame&&cancelAnimationFrame(W),W=0}return{start:function(){u?O(0):(F=!1,I='undefined'!=typeof performance?performance.now():0,q=null,G=0,O(0),'function'==typeof requestAnimationFrame&&(W=requestAnimationFrame(X)))},stop:B,setTime:function(t){q=t,O(t)},resize:function(t,a){A=t,R=a,H(t,a),O(L())},destroy:function(){B(),E={orbs:[],sparks:[]}},render:O,renderTo:function(t,a,r,o){H(a=a||A,r=r||R);var i=(o%l+l)%l,h=d(a,r),s=f(i,a,r,h,h);return t.setTransform(1,0,0,1,0,0),t.globalAlpha=1,t.fillStyle=n,t.fillRect(0,0,a,r),w(t,a,r,i,E,s,!1),M(t,C,s,i),w(t,a,r,i,E,s,!0),b(t,a,r),s},setLogo:function(t){C=t},getPeriod:function(){return l},getSize:function(){return{width:P,height:T}}}},PERIOD:t,FPS:30,SEED:r,VERSION:'1.0.0',logoSize:d,logoOrigin:f}},'object'==typeof m&&m.exports?m.exports=a():t.CandleScreensaver=a()},1375,[]); +__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||'')}},1376,[219]); +__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'},{id:'candle',label:'Candlelight',sub:'Warm gold candlelight drifting on a dark screen, with your logo slowly roaming'}],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},1378,[17,831,928,899,1377]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=b,e.guestRowText=function(n,l){const p=n.partySize,$=Math.max(0,Math.min(p-1,Math.round(Number(n.children)||0))),c=`${p} ${1===p?'person':'people'}${$?` (${$} ${1===$?'child':'children'})`:''}`,D=(0,s.tablesOf)(n.table??void 0),f=D.length?`${l.tableWord?'Table ':''}${(0,t.tableNumbers)(n.table)}`:'',h=l.leftEarly?"Left early"+(f?` \xb7 ${f}`:''):l.finished?"Finished"+(f?` \xb7 ${f}`:''):l.seated?"Seated"+(f?` \xb7 ${f}`:''):f||'No table yet',y=b(n),w=D.length?`table${D.length>1?'s':''} ${u(D.map(t.plainTableNumber))}`:l.finished?'finished':'no table yet',x=!!n.dog,k=(0,o.allergyLine)(n),m=(n.tags??[]).includes('VIP')?'VIP':(n.tags??[]).includes('Regular')?'Regular':null,P=n.occasion??(n.notes?/birthday/i.test(n.notes)?'birthday':/anniversary/i.test(n.notes)?'anniversary':null:null),v=(0,d.guestChangeLine)(n),I=[n.time,l.name,k?`allergy noted: ${k}`:'','VIP'===m?'VIP':'Regular'===m?'regular':'',P??'',c,l.leftEarly?'left early':l.finished?'finished':l.seated?'seated':'',y?.spoken??'',w,x?'dog':''].filter(Boolean).join(', ')+'.'+(v?` ${v}`:'');return{time:n.time,name:l.name,people:c,deposit:y?.text??null,depositWarn:!!y?.warn,table:h,dog:x,allergy:k,vip:m,occasion:P,guestChange:v,a11y:I}};var t=r(_d[0]),n=r(_d[1]),s=r(_d[2]),o=r(_d[3]),d=r(_d[4]);const l=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,u=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function b(t){const s=(0,n.depositBadge)(t,l);if(!s)return null;const o=(0,n.wixPayStatus)(t),d=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===o||d>0&&u>d&&!(0,n.isPaidLabel)(s.label)){const t=d||0;return t>0&&u>t?{text:`Deposit ${l(t)} of ${l(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}if(s.label.startsWith('Deposit waived'))return{text:'Deposit waived',spoken:'deposit waived',warn:!1};const b=s.label.match(/\xa3[\d.,]+/);if(s.label.startsWith(n.DEPOSIT_ADDED))return b?{text:`${n.DEPOSIT_ADDED} ${b[0]}`,spoken:`deposit added to bill, ${b[0].slice(1)} pounds`,warn:!1}:{text:n.DEPOSIT_ADDED,spoken:'deposit added to bill',warn:!1};if(s.label.startsWith('Deposit paid')){const t=/about/.test(s.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(s.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(s.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}}},1379,[843,841,998,1380,1381]); +__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])},1380,[845]); +__d(function(_g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestChangeOf=s,e.guestChangeLine=function(t){const n=s(t);if(!n||'cancelled'===t.status)return null;const m=[];n.from.date!==n.to.date&&m.push(o(n.from.date));n.from.time!==n.to.time&&m.push(n.from.time);n.from.partySize!==n.to.partySize&&m.push(`${n.from.partySize} ${1===n.from.partySize?'person':'people'}`);const c=u(n.at);return[`Changed by the guest${c?` at ${c}`:''}.`,m.length?`Was ${m.join(', ')}.`:'',n.needsTable?`Needs a table${n.from.table?` (was ${n.from.table})`:''}.`:'',n.needsCheck?'Needs confirming.':''].filter(Boolean).join(' ')};const t=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],n=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],o=o=>{const[u,s,m]=o.split('-').map(Number),c=new Date(Date.UTC(u,s-1,m,12));return`${t[c.getUTCDay()]} ${m} ${n[s-1]}`},u=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?'':n.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})};function s(t){const n=t.guestChange;return n&&'object'==typeof n&&n.from&&n.to?n:null}},1381,[]); +__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])},1382,[17,85,780,804,8]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:N,name:A,view:H,now:T,onClose:W,onDetails:_,onDone:F,otherDay:O,turnBase:R=90,onPickOnPlan:U,onEdit:G}){const[M,Y]=(0,n.useState)(null),[K,q]=(0,n.useState)(!1),[J,Q]=(0,n.useState)(null),[V,X]=(0,n.useState)(!1),Z=(0,w.useBookingWrite)(),[ee,te]=(0,n.useState)(!1),[se,ae]=(0,n.useState)(!1),[ie,le]=(0,n.useState)(!1),ne=(0,h.guestRowText)(N,{name:A,seated:'seated'===N.status&&!O}),oe='seated'===N.status&&!O,de=N.table?oe?`Seated \xb7 ${(0,l.tableCardLabel)(N.table)}`:(0,l.tableCardLabel)(N.table):oe?'Seated':'No table yet',re=O?[]:(0,k.guestActions)(N,A,H,T).filter(e=>'details'!==e.id),ce=(0,p.tableActions)(N,A),be={id:'details',label:'Guest details',a11y:`Guest details, ${A}`},ue=async t=>{if(!(0,a.guardBookingChange)(F,{b:N,tables:[t]}))return;const s={...N,table:t};t!==N.table&&await g.repo.bookings.update(N.id,{table:t}),await(0,y.seatBookingNow)(e,s),F(`Saving: ${A} at ${(0,k.tableWords)(t)}\u2026`),W(),(0,a.reportBookingSave)(N.id,`${A} seated at ${(0,k.tableWords)(t)}.`,`${A} at ${(0,k.tableWords)(t)}`,F)},ye=async e=>{!(0,v.needsEarlySeatConfirm)(N,T)||J?await ue(e):Q({go:()=>ue(e)})},ge=async t=>{if('seat'===t.id&&t.table)return ye(t.table);if('pick'===t.id)return q(e=>!e);if('details'===t.id)return W(),_(N);if('finished'===t.id){if(!Z.ok)return;return V?(X(!1),'seated'===N.status?await(0,D.finishAndOfferUndo)(e,[N],A,{big:!0,table:N.table}):await(0,D.finishUnseatedAndOfferUndo)(e,N,A,{big:!0}),W()):void X(!0)}return'noshow'===t.id?(await g.repo.bookings.setStatus(N.id,'noshow'),F(`${A} marked as a no-show.`),W()):void 0},ke=K?(0,k.freeTablesNow)(H,N.partySize,!0).slice(0,12):[];if(ee)return(0,L.jsx)(x.TablePicker,{rid:e,booking:N,name:A,turnBase:R,onClose:W,onSaved:F,onPickOnPlan:U?e=>{W(),U(N,e)}:void 0});if(se)return(0,L.jsx)(j.CancelWalkInConfirm,{rid:e,b:N,onClose:W,onDone:F});if(ie)return(0,L.jsx)(C.CancelBookingConfirm,{rid:e,b:N,name:A,onClose:W,onDone:F});const he=[...re];return(0,L.jsxs)(u.Sheet,{visible:!0,onClose:W,title:`${N.time} \xb7 ${A}`,maxWidth:560,testID:"guest-actions",children:[(0,L.jsx)(a.BookingNotSavedLine,{b:N}),(0,L.jsx)(c.default,{accessible:!0,accessibilityLabel:ne.a11y,testID:"guest-actions-summary",children:(0,L.jsxs)(u.T,{size:18,children:[ne.people,ne.deposit?(0,L.jsxs)(u.T,{size:18,weight:"semibold",colour:ne.depositWarn?$.colours.amber:$.colours.goldLight,style:b.KEEP_TOGETHER,children:[" \xb7 ",ne.deposit]}):null," \xb7 ",de]})}),(0,L.jsx)(t.ShowNumberButton,{b:N}),J?(0,L.jsx)(B.EarlySeatConfirm,{time:N.time,onYes:()=>{const e=J.go;Q(null),e()},onNo:()=>Q(null)}):null,V?(0,L.jsx)(D.FinishConfirm,{prompt:(0,I.finishConfirmPrompt)({name:A,table:N.table,seatedAt:N.seatedAt,now:T,seated:'seated'===N.status}),onNo:()=>X(!1),onYes:()=>{ge({id:'finished',label:'Finished',a11y:''})}}):null,'finished'!==N.status||O?null:(0,L.jsx)(c.default,{style:{alignItems:'center'},children:(0,L.jsx)(P.BookingUndo,{b:N,rid:e,today:(0,f.ymd)(T),who:A,allowed:Z.ok})}),(0,L.jsxs)(c.default,{style:{gap:10},children:[he.map(e=>(0,L.jsxs)(o.default.Fragment,{children:[(0,L.jsx)(u.Button,{kind:E(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:()=>ge(e),style:z}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,L.jsxs)(u.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&K?(0,L.jsxs)(c.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===ke.length?(0,L.jsx)(u.Muted,{children:"No free tables right now."}):null,M?(0,L.jsxs)(c.default,{testID:"guest-pick-overcap",accessible:!0,accessibilityRole:"alert",accessibilityLiveRegion:"assertive",accessibilityLabel:M.ask,style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:$.colours.amber,backgroundColor:$.colours.amberBg},children:[(0,L.jsx)(u.T,{size:17,weight:"semibold",center:!0,colour:"#FFE2A8",children:M.ask}),(0,L.jsx)(u.Button,{label:"Use it anyway",testID:"guest-pick-overcap-yes",disabled:!Z.ok,accessibilityHint:Z.hint,onPress:()=>{const e=M.table;Y(null),ye(e)},style:z}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Pick another table",testID:"guest-pick-overcap-no",onPress:()=>Y(null),style:z})]}):ke.map(e=>(0,L.jsx)(u.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,sub:e.seats{const t=(0,p.overCapacityAsk)([e.table],e.seats,N.partySize);t?Y({table:e.table,ask:t}):ye(e.table)},style:z},e.table))]}):null]},e.id)),ce.map(t=>(0,L.jsx)(u.Button,{kind:"secondary",label:t.label,accessibilityLabel:t.a11y,accessibilityHint:Z.hint,disabled:!Z.ok,testID:`guest-act-${t.id}`,style:z,onPress:async()=>{if(Z.ok)return'assign'===t.id?te(!0):void((0,a.guardBookingChange)(F,{b:N,tables:[]})&&(W(),await(0,a.saveTablesReported)(e,N,[],A,0,F)))}},t.id)),!O&&(0,j.canCancelWalkIn)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${N.ref}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelwalkin",onPress:()=>ae(!0),style:z}):null,(0,S.canCancelBooking)(N)?(0,L.jsx)(u.Button,{kind:"secondary",label:"Cancel booking",accessibilityLabel:`Cancel booking for ${A}, ${N.time}, ${N.partySize} Covers`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-cancelbooking",onPress:()=>le(!0),style:z}):null,!G||N.walkIn||['cancelled','noshow'].includes(N.status)||O&&!(N.date>=(0,f.ymd)(T))?null:(0,L.jsx)(u.Button,{kind:"secondary",label:"Edit booking",accessibilityLabel:`Edit booking, ${A}, ${N.time}. Date, time, covers, table, anything.`,accessibilityHint:Z.hint,disabled:!Z.ok,testID:"guest-act-edit",onPress:()=>{W(),G(N)},style:z}),(0,L.jsx)(u.Button,{kind:"ghost",label:be.label,accessibilityLabel:be.a11y,testID:"guest-act-details",onPress:()=>ge(be),style:z})]}),(0,L.jsx)(u.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:W,style:z})]})};var t=r(d[0]),s=r(d[1]),a=r(d[2]),l=r(d[3]),n=r(d[4]),o=e(n),c=e(r(d[5])),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),k=r(d[10]),h=r(d[11]),p=r(d[12]),f=r(d[13]),x=r(d[14]),j=r(d[15]),C=r(d[16]),S=r(d[17]),$=r(d[18]),w=r(d[19]),v=r(d[20]),B=r(d[21]),D=r(d[22]),P=r(d[23]),I=r(d[24]),L=r(d[25]);const z={minHeight:64},E=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},1383,[1384,843,1095,998,17,85,1359,777,1098,858,1116,1379,1096,863,1093,1117,1118,1119,804,1338,1386,1387,1115,1355,1113,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ShowNumberButton=function({b:e}){const y=(0,u.useSession)(e=>e.meId),w=(0,c.useOwner)(e=>e.staff.find(e=>e.id===y&&e.active)),[I,C]=(0,t.useState)(!1),[j,D]=(0,t.useState)(b.SHOW_NUMBER_SECS);if((0,t.useEffect)(()=>{if(!I)return;D(b.SHOW_NUMBER_SECS);const e=Date.now(),t=setInterval(()=>{const t=b.SHOW_NUMBER_SECS-Math.floor((Date.now()-e)/1e3);t<=0?C(!1):D(t)},1e3);return()=>clearInterval(t)},[I]),!(0,b.canShowNumber)(e,!y||(0,h.canChangeBookings)(w)))return null;const E=f.IS_CAR?'car':'display'===f.APP_VARIANT?'Display':'Managers app';if(!I)return(0,_.jsx)(p.Button,{kind:"secondary",label:"Show phone number",testID:"show-number",accessibilityLabel:`Show phone number for ${e.name}`,onPress:()=>{C(!0);const t=e.editLog??[];l.repo.bookings.update(e.id,{editLog:[...t,(0,b.revealEntry)(w?.name?.replace(' (example)','')??'',E,(new Date).toISOString())].slice(-50)}).catch(()=>{})},style:{minHeight:64}});const H=String(e.phone);return(0,_.jsxs)(s.default,{testID:"shown-number",style:{gap:8,padding:14,borderRadius:14,borderWidth:2,borderColor:S.colours.gold,backgroundColor:'#15130F'},children:[(0,_.jsx)(o.default,{accessibilityRole:"link",accessibilityLabel:`Call ${e.name} on ${H}`,testID:"call-number",onPress:()=>{n.default.openURL((0,b.telHrefOf)(H)).catch(()=>{})},style:{minHeight:56,justifyContent:'center'},children:(0,_.jsxs)(p.T,{size:28,weight:"bold",colour:S.colours.goldLight,children:["\ud83d\udcde ",H]})}),(0,_.jsxs)(p.T,{size:14,colour:S.colours.muted,children:["Tap the number to call. Hides in ",j,"s \xb7 saved in the booking history"]}),(0,_.jsx)(p.Button,{small:!0,kind:"ghost",label:"Hide number",testID:"hide-number",onPress:()=>C(!1)})]})};var t=r(d[0]),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),l=r(d[4]),u=r(d[5]),c=r(d[6]),h=r(d[7]),b=r(d[8]),f=r(d[9]),S=r(d[10]),p=r(d[11]),_=r(d[12])},1384,[17,362,385,85,858,920,876,996,1385,856,804,777,8]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOW_NUMBER_SECS",{enumerable:!0,get:function(){return t}}),e.canShowNumber=function(t,n){return n&&!t.walkIn&&!!(t.phone??'').replace(/[^\d+]/g,'')},Object.defineProperty(e,"telHrefOf",{enumerable:!0,get:function(){return n}}),e.revealEntry=function(t,n,u){const c=(t||n).slice(0,80);return{at:u,by:c,app:n,fields:['phone'],text:`Phone number shown on the ${n} by ${c} ${o(u)}`}};const t=30;const n=t=>`tel:${t.replace(/[^\d+]/g,'')}`,o=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`}},1385,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EARLY_SEAT_MINS",{enumerable:!0,get:function(){return n}}),e.needsEarlySeatConfirm=function(n,o){if(n.walkIn||!n.date||!n.time)return!1;const u=(0,t.atTime)((0,t.parseYmd)(n.date),n.time);return o.getTime()'confirmed'===e.status).map(e=>({b:e,m:(0,c.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,P.jsxs)(y.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",colour:$.colours.gold,children:"NEXT HOUR"}),(0,P.jsxs)(x.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===l.length?(0,P.jsx)(p.Muted,{children:"No arrivals due in the next hour."}):null,l.map(({b:e,m:t})=>(0,P.jsxs)(y.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?$.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?$.colours.amber:'#3C78B5'},children:[(0,P.jsx)(p.T,{size:13,weight:"semibold",children:e.time}),(0,P.jsxs)(p.T,{size:13,children:[(0,j.privName)(e,s)," \xb7 ",e.partySize]}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,accessibilityLabel:e.table?(0,n.tableNumbersA11y)(e.table):'No table',children:e.table?`${(0,n.tableNumbers)(e.table)}`:'no table'}),(0,P.jsx)(p.T,{size:12,colour:t<0?$.colours.amber:$.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,P.jsx)(p.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,P.jsx)(p.T,{size:12,children:C.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,P.jsxs)(p.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','soon','seated','dirty'].map(e=>(0,P.jsxs)(p.Row,{gap:4,children:[(0,P.jsx)(y.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:C.STATUS[e].colour}}),(0,P.jsx)(p.T,{size:12,colour:$.colours.muted,children:C.STATUS[e].label})]},e)),(0,P.jsx)(p.T,{size:12,colour:$.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,b.useState)(20);return(0,b.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,b.useEffect)(()=>{l<=0&&s()},[l]),(0,P.jsxs)(p.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,P.jsx)(p.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,P.jsx)(p.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return L}}),_e.TableSheet=function({rid:e,name:s,view:l,plan:o,todays:h,now:x,privacy:v,turnBase:T,onClose:M,onWalkIn:L,onMove:A,onDetails:R}){const W=l[s],O=k.useFloor.getState(),[H,E]=(0,b.useState)(!1),[F,U]=(0,b.useState)(W?.note??''),[_,G]=(0,b.useState)(!1),[Y,V]=(0,b.useState)(!1),[K,q]=(0,b.useState)(!1),[J,X]=(0,b.useState)(null),[Q,Z]=(0,b.useState)(null),ee=(0,I.useBookingWrite)(),te=async(e,t)=>{(0,B.needsEarlySeatConfirm)(e,x)?X({time:e.time,go:t}):await t()};if(!W)return null;const se=W.booking,le=['seated','mains','dessert','bill'].includes(W.status);if(le&&!Y){const l=se?(0,j.privName)(se,v):'the party',a=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x)),o=a.reduce((e,t)=>e+t.partySize,0);return(0,P.jsx)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:560,testID:"seated-table-sheet",children:(0,P.jsxs)(y.default,{style:{alignItems:'center',gap:12,width:'100%'},children:[se?(0,P.jsxs)(p.T,{size:18,center:!0,weight:"semibold",testID:"seated-sheet-who",children:[l," \xb7 ",se.partySize," ",1===se.partySize?'person':'people'," \xb7 seated ",W.seatedMins," min"]}):(0,P.jsx)(p.T,{size:18,center:!0,children:"Table order open"}),a.length>1?(0,P.jsxs)(p.T,{size:15,center:!0,colour:$.colours.goldLight,testID:"seated-sheet-parties",children:[a.length," parties seated here \xb7 ",o," people. Clear table clears all of them."]}):null,'clear'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:l,table:s,parties:a.length,seatedAt:se?.seatedAt,now:x,seated:!0}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{await(0,z.finishAndOfferUndo)(e,a.length?a:se?[se]:[],l,{big:!0,table:s}),k.useFloor.getState().setLive(e,s,{stage:void 0,dirty:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"primary",label:"Clear table",testID:"clear-table",accessibilityLabel:a.length>1?`Clear ${(0,n.tableNumbersA11y)(s)}: all ${a.length} parties have left, table needs clearing`:`Clear ${(0,n.tableNumbersA11y)(s)}: ${l} has left, table needs clearing`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&Z('clear')},style:{minHeight:72,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}),se&&!K?(0,P.jsx)(p.Button,{kind:"secondary",label:"Unseat",testID:"unseat-table",accessibilityLabel:`Unseat ${l}: ${se.walkIn?'removes the walk-in':'back to booked'}, table free again`,accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>q(!0),style:{minHeight:60,width:'100%',maxWidth:420,alignSelf:'center'}}):null,se&&K?(0,P.jsxs)(y.default,{testID:"unseat-table-confirm",accessibilityLiveRegion:"polite",style:{gap:8,width:'100%',maxWidth:420,alignItems:'center',borderWidth:1.5,borderColor:$.colours.gold,borderRadius:12,padding:10},children:[(0,P.jsxs)(p.T,{size:16,center:!0,weight:"semibold",children:["Unseat ",l,"? ",se.walkIn?'The walk-in is removed':'They go back to Booked'," and ",(0,n.tableNumbers)(s)," is free again."]}),(0,P.jsxs)(p.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{label:"Yes, unseat",testID:"unseat-table-yes",onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(se.id,(0,C.unseatStatus)(se)),(0,k.tablesOf)(se.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!1})),M())},style:{minHeight:56}}),(0,P.jsx)(p.Button,{kind:"ghost",label:"Keep seated",testID:"unseat-table-no",onPress:()=>q(!1),style:{minHeight:56}})]})]}):null,se?(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Move table",testID:"move-party",accessibilityLabel:`Move ${l} to another table`,onPress:()=>{M(),A(s)},style:{minHeight:48,alignSelf:'center'}}):null,(0,P.jsxs)(y.default,{testID:"seated-extra",style:{width:'100%',gap:10,alignItems:'center',borderTopWidth:1,borderColor:$.colours.hairline,paddingTop:10},children:[(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):null,W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se?(0,P.jsx)(S.DepositChip,{b:se,money:!0,testID:"table-sheet-deposit"}):null]}),(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:"secondary",label:"Block table",onPress:()=>{O.setLive(e,s,{blocked:!0}),M()},testID:"block-table"}),(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',testID:"table-note",onPress:()=>E(!H)}),se?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,style:{width:'100%',maxWidth:420},children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,se&&se.walkIn?(0,P.jsx)(y.default,{style:{width:'100%',maxWidth:420},children:(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0})}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null]})]})})}const ae=h.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,c.minsBetween)(x,(0,C.startOf)(e)))-Math.abs((0,c.minsBetween)(x,(0,C.startOf)(t)))),ie=e=>e.partySize<=W.table.maxSeats,ne=W.next??W.due,oe=(0,C.turnFor)(W.covers||W.table.maxSeats,T);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:M,title:`${(0,n.tableNumbers)(s)} \xb7 ${C.STATUS[W.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===W.status?(0,P.jsx)(p.Button,{kind:"primary",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${s} cleared, table free`,onPress:()=>{k.useFloor.getState().setLive(e,s,{dirty:!1,stage:void 0}),M()},testID:"mark-clean",style:{minHeight:64,width:'100%',maxWidth:420,alignSelf:'center',...t.look.primary(!1)}}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Badge,{kind:"neutral",label:`${W.table.minSeats}\u2013${W.table.maxSeats} seats`}),se?(0,P.jsx)(p.Badge,{kind:"gold",label:`${(0,j.privName)(se,v)} \xb7 ${se.partySize} \xb7 ${W.seatedMins}m`}):null,se?(0,P.jsx)(p.Badge,{kind:W.seatedMins>(0,C.durOf)(se,T)?'red':'neutral',label:`Turn about ${(0,C.durOf)(se,T)} min \xb7 free about ${(0,c.hm)((0,C.endOf)(se,T))} (est.)`}):(0,P.jsx)(p.Badge,{kind:"neutral",label:`Turn estimate for ${W.table.maxSeats}: about ${oe} min`}),W.next?(0,P.jsx)(p.Badge,{kind:"blue",label:`Next: ${W.next.time} ${(0,j.privName)(W.next,v)} (${W.next.partySize})`}):null,W.allergy?(0,P.jsx)(p.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,se??ne?(0,P.jsx)(S.DepositChip,{b:se??ne,money:!0,testID:"table-sheet-deposit"}):null]}),se??ne?(0,P.jsx)(r.BookingTableButton,{rid:e,booking:se??ne,turnBase:T,testID:"table-sheet-table-btn"}):null,se&&se.walkIn?(0,P.jsx)(u.CancelWalkInButton,{rid:e,b:se,big:!0}):null,se&&se.walkIn?(0,P.jsx)(u.ReinstateWalkInButton,{rid:e,b:se,today:(0,c.ymd)(new Date)}):null,J?(0,P.jsx)(D.EarlySeatConfirm,{time:J.time,onYes:()=>{const e=J.go;X(null),e()},onNo:()=>X(null)}):null,!le&&'blocked'!==W.status&&ne?(0,P.jsx)(p.Button,{label:`Seat ${(0,j.privName)(ne,v)}`,accessibilityLabel:`Seat ${(0,j.privName)(ne,v)}, ${ne.time} booking, ${ne.partySize} ${1===ne.partySize?'person':'people'}, at table ${s}`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{if(!ee.ok||!(0,a.guardBookingChange)(void 0,{b:ne,tables:[s]}))return;const t=ne;await te(t,async()=>{await w.repo.bookings.update(t.id,{table:t.table&&(0,k.tablesOf)(t.table).includes(s)?t.table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})}}):null,!le&&'blocked'!==W.status&&ne&&(0,C.startOf)(ne)<=x?(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:['due'===Q?(0,P.jsx)(z.FinishConfirm,{prompt:(0,N.finishConfirmPrompt)({name:(0,j.privName)(ne,v),table:ne.table,seatedAt:ne.seatedAt,now:x,seated:'seated'===ne.status}),onNo:()=>Z(null),onYes:()=>{ee.ok&&(Z(null),(async()=>{'seated'===ne.status?await(0,z.finishAndOfferUndo)(e,[ne],(0,j.privName)(ne,v),{big:!0,table:ne.table}):await(0,z.finishUnseatedAndOfferUndo)(e,ne,(0,j.privName)(ne,v),{big:!0}),M()})())}}):(0,P.jsx)(p.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,j.privName)(ne,v)}, ${ne.time} booking, without seating`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-finished",style:{flex:1,minHeight:56},onPress:()=>{ee.ok&&Z('due')}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,j.privName)(ne,v)}, ${ne.time} booking`,accessibilityHint:ee.hint,disabled:!ee.ok,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{ee.ok&&(await w.repo.bookings.setStatus(ne.id,'noshow'),M())}})]}):null,le||'blocked'===W.status?null:(0,P.jsxs)(p.Row,{gap:8,style:{justifyContent:'center'},children:[(0,P.jsx)(p.Button,{kind:'dirty'===W.status?'secondary':'primary',label:"Seat walk-in here",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&('dirty'===W.status&&k.useFloor.getState().setLive(e,s,{dirty:!1}),M(),L(s))},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,P.jsx)(p.Button,{kind:"secondary",label:"Seat a booking",accessibilityHint:ee.hint,disabled:!ee.ok,onPress:()=>{ee.ok&&G(!_)},testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),_?(0,P.jsxs)(y.default,{style:{gap:6},children:[0===ae.length?(0,P.jsx)(p.Muted,{children:"No bookings left to seat today."}):null,ae.slice(0,8).map(t=>(0,P.jsxs)(m.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,j.privName)(t,v)} ${t.time}`,onPress:async()=>{(0,a.guardBookingChange)(void 0,{b:t,tables:[s]})&&await te(t,async()=>{await w.repo.bookings.update(t.id,{table:s}),await w.repo.bookings.setStatus(t.id,'seated'),(0,f.resetTableLive)(e,s),M()})},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:ie(t)?$.colours.border:$.colours.amber,backgroundColor:$.colours.surface2},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:[t.time," \xb7 ",(0,j.privName)(t,v)," \xb7 ",t.partySize,t.table?` \xb7 booked ${(0,n.tableNumbers)(t.table)}`:'',t.allergies.length?' \xb7 \u26a0':'']}),ie(t)?null:(0,P.jsxs)(p.T,{size:12,colour:$.colours.amber,children:["Bigger than this table (",W.table.maxSeats," max)"]})]},t.id))]}):null,le?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p.T,{size:14,center:!0,colour:$.colours.muted,children:"Course / status"}),(0,P.jsx)(p.Row,{wrap:!0,gap:6,style:{justifyContent:'center'},children:C.STAGES.map(t=>(0,P.jsx)(p.Chip,{label:C.STAGE_LABEL[t],selected:W.status===t,onPress:()=>O.setLive(e,s,{stage:t})},t))}),(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[se?(0,P.jsx)(p.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{M(),A(s)},testID:"move-party"}):null,(0,P.jsx)(p.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{const t=(0,C.seatedPartiesAt)(s,h,(0,c.ymd)(x));for(const s of t)await w.repo.bookings.setStatus(s.id,'finished'),(0,k.tablesOf)(s.table).forEach(t=>O.setLive(e,t,{stage:void 0,dirty:!0}));O.setLive(e,s,{stage:void 0,dirty:!0}),M()}})]})]}):null,(0,P.jsxs)(p.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:['dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"secondary",label:'blocked'===W.status?'Unblock table':'Block table',onPress:()=>{O.setLive(e,s,{blocked:'blocked'!==W.status}),M()},testID:"block-table"}),'dirty'===W.status?null:(0,P.jsx)(p.Button,{kind:"ghost",label:W.note?'Edit note':'Note',onPress:()=>E(!H)}),se||ne?(0,P.jsx)(p.Button,{kind:"ghost",label:"Guest details",onPress:()=>{M(),R(se??ne)},testID:"guest-details"}):null]}),H?(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Table note",value:F,onChangeText:U,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[p.styles.input,{flex:1}]}),(0,P.jsx)(p.Button,{small:!0,label:"Save",onPress:()=>{O.setLive(e,s,{note:F.trim()||void 0}),E(!1)}})]}):null,v?(0,P.jsx)(p.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,o.joins.some(e=>e.tables.includes(s))?(0,P.jsxs)(p.Muted,{children:["Joins with ",o.joins.find(e=>e.tables.includes(s)).tables.filter(e=>e!==s).join(', ')," for bigger parties (book as ",o.joins.find(e=>e.tables.includes(s)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:s,view:l,todays:a,waiting:n,now:o,privacy:r,busy:u,onToast:h}){const[x,v]=(0,b.useState)(''),[S,I]=(0,b.useState)(2),B=(0,k.useFloor)(e=>e.smsLog);return(0,P.jsxs)(M,{title:`Waitlist (${n.length})`,right:(0,P.jsxs)(p.Muted,{children:["new party about ",(0,T.estimateWait)(n.length+1,t.settings.turnMins,u)," min"]}),testID:"waitlist-panel",children:[0===n.length?(0,P.jsx)(p.Muted,{children:"Nobody waiting."}):null,n.map((i,n)=>{const b=(0,C.suggestTable)(s,a,l,i.partySize,o,(0,C.turnFor)(i.partySize,t.settings.turnMins)),m=(0,T.estimateWait)(n+1,t.settings.turnMins,u),x=Math.max(0,(0,c.minsBetween)(new Date(i.joinedAt),o)),v=B.find(t=>t.rid===e&&t.text.includes(`#${i.number} `));return(0,P.jsxs)(y.default,{style:{backgroundColor:$.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsxs)(p.T,{weight:"semibold",children:["#",i.number," ",(0,j.pv)(i.name,r)," \xb7 ",i.partySize]}),(0,P.jsxs)(p.T,{size:12,colour:x>m?$.colours.amber:$.colours.muted,children:["waited ",x,"m \xb7 quoted about ",m,"m"]})]}),b?(0,P.jsxs)(p.T,{size:12,colour:b.clashes?$.colours.amber:$.colours.ok,children:["Best table: ",b.table," (",b.why,")"]}):(0,P.jsx)(p.T,{size:12,colour:$.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,P.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,P.jsx)(p.Button,{small:!0,label:v||'notified'===i.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${i.number}`,onPress:()=>{k.useFloor.getState().logSms(e,o.toISOString(),`#${i.number} ${i.partySize}: Your table at ${t.name} is ready.`),w.repo.waitlist.setStatus(i.id,'notified'),h(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),b?(0,P.jsx)(p.Button,{small:!0,kind:"success",label:`Seat at ${b.table}`,onPress:async()=>{await w.repo.waitlist.setStatus(i.id,'seated'),await w.repo.bookings.seatWalkIn(e,i.partySize,b.table,`From waitlist #${i.number}`),(0,f.resetTableLive)(e,b.table),h(`Waitlist #${i.number} seated at ${b.table}`)}}):null,(0,P.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>w.repo.waitlist.setStatus(i.id,'removed')})]}),'notified'===i.status?(0,P.jsx)(p.Badge,{kind:"ok",label:`Told table ready${v?` ${(0,c.hm)(new Date(v.at))}`:''} `}):null]},i.id)}),(0,P.jsxs)(p.Row,{gap:6,children:[(0,P.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:x,onChangeText:v,style:[p.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,P.jsx)(m.default,{accessibilityLabel:"Waitlist party size",onPress:()=>I(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:$.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,P.jsx)(p.T,{weight:"bold",colour:$.colours.gold,children:S})}),(0,P.jsx)(p.Button,{small:!0,label:"Add",disabled:x.trim().length<2,onPress:()=>{w.repo.waitlist.join(e,x.trim(),S),v('')}})]})]})},_e.PacePanel=function({r:e,fc:t,todays:s,now:a,walkInCount:i,staffOn:n,onSummary:r}){const u=i+s.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),b=a.getHours(),h=Math.round(t.hours.filter(e=>e.houre+t.covers,0)+(t.hours.find(e=>e.hour===b)?.covers??0)*(a.getMinutes()/60)),m=h?u/h:1,x=m>=1.1?$.colours.amber:m>=.85?$.colours.ok:$.colours.blue,f=Array.from({length:8},(e,t)=>{const l=(0,c.addMins)(a,15*(t-4)-a.getMinutes()%15),i=(0,c.addMins)(l,15),n=s.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,C.startOf)(e);return t>=l&&te+t.partySize,0);return{from:l,covers:n,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),w=Math.max(j,...f.map(e=>e.covers)),k=f.filter(e=>e.future&&e.covers>j),v=t.nextHour?.covers??0,S=Math.ceil(v/16);return(0,P.jsxs)(M,{title:"Pace & kitchen",right:(0,P.jsx)(p.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,P.jsxs)(y.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${h}`,style:{gap:4},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{size:14,children:"Covers so far"}),(0,P.jsxs)(p.T,{weight:"bold",colour:x,children:[u," ",(0,P.jsxs)(p.T,{size:13,colour:$.colours.muted,children:["/ about ",h," forecast"]})]})]}),(0,P.jsx)(y.default,{style:{height:10,borderRadius:5,backgroundColor:(0,l.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,P.jsx)(y.default,{style:{width:`${Math.min(100,75*m)}%`,height:10,borderRadius:5,backgroundColor:x}})}),(0,P.jsxs)(p.Muted,{children:[m>=1.1?'Ahead of forecast':m>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",t.nextHour?(0,o.coversRange)(t.nextHour.coversLow,t.nextHour.coversHigh):'0 Covers']})]}),(0,P.jsx)(p.T,{size:13,colour:$.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,P.jsx)(y.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:f.map((e,t)=>(0,P.jsxs)(y.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,P.jsx)(p.T,{size:10,colour:$.colours.muted,children:e.covers||''}),(0,P.jsx)(y.default,{style:{width:'80%',height:Math.max(2,e.covers/w*40),borderRadius:3,backgroundColor:e.covers>j?$.colours.red:e.future?'#6B5A3A':$.colours.gold}}),(0,P.jsx)(p.T,{size:9,colour:4===t?$.colours.gold:$.colours.muted,children:(0,c.hm)(e.from)})]},t))}),k.map(e=>(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Kitchen: ",e.covers," Covers due ",(0,c.hm)(e.from),"\u2013",(0,c.hm)((0,c.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),S>n?(0,P.jsxs)(p.T,{size:13,colour:$.colours.amber,children:["\u26a0 Next hour about ",v," Covers with ",n," on: about ",S-n," more on the floor suggested."]}):(0,P.jsxs)(p.T,{size:13,colour:$.colours.ok,children:["Staffing looks OK for the next hour (",n," on)."]}),(0,P.jsx)(p.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:r,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:i}){const n=t.filter(e=>['seated','finished'].includes(e.status)),o=n.reduce((e,t)=>e+t.partySize,0)+a,r=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,c.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),b=(0,k.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),h=(e,t)=>(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{children:e}),(0,P.jsx)(p.T,{weight:"semibold",children:t})]},e);return(0,P.jsxs)(p.Sheet,{visible:!0,onClose:i,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[h('Covers served',String(o)),h('Bookings seated',`${n.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),h('Walk-ins',`${r.length} parties \xb7 ${r.reduce((e,t)=>e+t.partySize,0)+a} Covers`),h('No-shows',String(t.filter(e=>'noshow'===e.status).length)),h('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.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,P.jsx)(p.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return k.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),i=_r(d[4]),n=_r(d[5]),o=_r(d[6]),r=_r(d[7]),u=_r(d[8]),c=_r(d[9]),b=_r(d[10]),h=_r(d[11]);_r(d[12]);var m=e(_r(d[13])),x=e(_r(d[14])),y=e(_r(d[15])),p=_r(d[16]),f=_r(d[17]),j=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),C=_r(d[23]),T=_r(d[24]),$=_r(d[25]),I=_r(d[26]),B=_r(d[27]),D=_r(d[28]),z=_r(d[29]),N=_r(d[30]),P=_r(d[31]);const M=({title:e,right:t,children:s,testID:l})=>(0,P.jsxs)(y.default,{testID:l,style:{backgroundColor:$.colours.surface,borderRadius:14,borderWidth:1,borderColor:$.colours.border,padding:10,gap:6},children:[(0,P.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,P.jsx)(p.T,{weight:"semibold",colour:$.colours.gold,children:e}),t]}),s]});const L=e=>(0,P.jsxs)(y.default,{style:{gap:6},children:[(0,P.jsxs)(p.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,P.jsxs)(p.Muted,{children:[e.time," \xb7 ",e.table?(0,k.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,P.jsx)(S.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,P.jsx)(h.BookingNeeds,{b:e,big:!0}),e.notes?(0,P.jsxs)(p.T,{children:["Notes: ",e.notes]}):(0,P.jsx)(p.Muted,{children:"No notes."}),e.allergies.length?(0,P.jsx)(y.default,{style:{backgroundColor:$.colours.redBg,borderRadius:8,padding:8},children:(0,P.jsxs)(p.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,v.allergenLabel)(e.allergen)} \u2014 ${(0,v.severityLabel)(e.severity)}`).join('; ')]})}):(0,P.jsx)(p.Muted,{children:"No allergies declared."}),(0,P.jsx)(s.ShowNumberButton,{b:e},`num-${e.id}`)]});const A=!0},1388,[1172,1384,813,1095,812,843,1140,1091,1117,863,17,1078,219,385,278,85,777,1098,1372,858,998,845,1089,1076,1316,804,1338,1386,1387,1115,1113,8]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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.']}]},1389,[812,17,219,385,85,777,858,998,1390,804,1391,1393,8]); +__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))},1390,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},1391,[831,858,998,1390,1392,1393]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},1392,[843]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},1393,[219,1392]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=j,_e.BlockBookingsSheet=v,_e.BlocksBanner=function({rid:e,now:o,big:s,by:t="staff"}){const l=(0,i.useBlocks)(e=>e.blocks),n=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(l,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(P,{rid:e,now:o,big:s}),(0,f.jsxs)(r.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:a.privateFunction?'column':'row',alignItems:a.privateFunction?'stretch':'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!!a.privateFunction,colour:u.colours.amber,style:{flex:a.privateFunction?void 0:1,minWidth:0},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",style:a.privateFunction?{width:'100%'}:void 0,testID:"blocks-undo",onPress:()=>{n(a.id,t),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(P,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:p,tile:y,display:j,day:k}){const[w,B]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),M=k??(0,c.ymd)(a),D=C.filter(o=>o.rid===e&&o.date===M&&!o.removedAt).length,P=D?`${D} block${1===D?'':'s'} that day`:'';return y?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(t.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:P||'Pause online times',count:D||void 0,onPress:()=>B(!0),accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings'}),w?(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(n.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:P?`Block bookings, ${P}`:'Block bookings',onPress:()=>B(!0),style:({pressed:e})=>p?{...l.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[p?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:p?15:x?22:17,weight:"semibold",colour:p?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),D?(0,f.jsx)(r.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:D})}):null]}),w?j?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>B(!1)}):(0,f.jsx)(v,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>B(!1)}):null]})},_e.closeOutdoor=B,_e.useOutdoor=C,Object.defineProperty(_e,"isSeasonAreaClose",{enumerable:!0,get:function(){return M}}),_e.CloseGardenButton=function({rid:e,r:o,now:s,by:r,big:a,quiet:d,short:c,tile:h}){const m=C(e,s);if(!m.outdoor.length)return null;const x=m.allClosed,p=x&&m.active.length>0&&m.active.every(M),y=p?'Reopen garden, closed for winter':'Reopen garden';return h?(0,f.jsx)(t.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?p?'Closed for winter':'Closed for weather':'For weather',accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(n.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?y:'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):B(e,o,s,r,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...l.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=P;var o=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),r=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),p=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function y({title:e,sub:o,onPress:s,testID:t,disabled:l}){return(0,f.jsxs)(n.default,{testID:t,accessibilityRole:"button",accessibilityLabel:e,disabled:l,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:l?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function j({rid:e,now:t,by:l="staff"}){const n=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(t),y=(0,i.currentBlocks)(n,e,x,(0,c.hm)(t));return y.length?(0,f.jsxs)(r.default,{style:{gap:8},testID:"block-list",children:[y.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(t));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(r.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',p(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${p(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,l),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function k({value:e,onChange:o}){return(0,f.jsxs)(r.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:t,max:l}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(t,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(l,o+30))})]})}function v({rid:e,r:o,now:t,by:l,onClose:n,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[p,v]=(0,s.useState)(),B=(0,c.ymd)(t),C=(0,d.hoursFor)(o,t),M=C?(0,c.hm)(C.close):null,P=x(t),I=!!C&&(0,c.toMins)(P)<(0,c.toMins)(M),T=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const l=new Date(t);l.setHours(12,0,0,0),l.setDate(l.getDate()+s),(0,d.hoursFor)(o,l)&&e.push(l)}return e},[B,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):B),F=(0,d.hoursFor)(o,(0,c.parseYmd)($)),S=F?(0,c.toMins)((0,c.hm)(F.open)):720,W=F?(0,c.toMins)((0,c.hm)(F.close)):1260,[L,A]=(0,s.useState)(null),N=L??{from:S,to:W},H=(o,s,t)=>{u({rid:e,date:o,from:s,to:t,reason:p,by:l}),n()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(y,{testID:"block-today",title:"Today",sub:I?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!I,onPress:()=>m('today')}),(0,f.jsx)(y,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:t,by:l,onDone:n}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(j,{rid:e,now:t})]}):'today'===h?(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(y,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(B,P,M)}),(0,f.jsx)(y,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${T}`,onPress:()=>H(B,P,T)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(r.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===S&&N.to===W,onPress:()=>A({from:S,to:W})}),S<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(S)}\u201317:00`,selected:N.from===S&&1020===N.to,onPress:()=>A({from:S,to:Math.min(1020,W)})}):null,W>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(W)}`,selected:1020===N.from&&N.to===W,onPress:()=>A({from:Math.max(1020,S),to:W})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:S,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:W,onChange:e=>A({...N,to:e})}),(0,f.jsx)(k,{value:p,onChange:v}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function B(e,o,s,t,l){const n=(0,d.hoursFor)(o,s),r=x(s),a=n?(0,c.hm)(n.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(r)?a:'23:59';return l.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:r,to:u,reason:'Weather',by:t,areaId:o.id,areaName:o.name}))}function C(e,o){const s=(0,a.usePlan)(e),t=(0,i.useBlocks)(e=>e.blocks),l=s.areas.filter(e=>e.outdoor),n=(0,i.closedAreasAt)(t,e,(0,c.ymd)(o),(0,c.hm)(o)),r=t.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:l,closed:n,active:r,allClosed:l.length>0&&l.every(e=>n.has(e.id))}}const M=e=>!!e.areaId&&(!!e.wholeDay||(0,c.toMins)(e.from)<=0&&(0,c.toMins)(e.to)>=(0,c.toMins)('23:59'));function D({rid:e,r:o,now:s,by:t,onDone:l}){const n=C(e,s);return!n.outdoor.length||n.allClosed?null:(0,f.jsx)(y,{testID:"block-garden",title:"Close garden for weather",sub:`${n.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{B(e,o,s,t,n.outdoor.filter(e=>!n.closed.has(e.id))),l()}})}function P({rid:e,now:o,big:s}){const t=C(e,o);if(!t.active.length)return null;if(t.active.every(M))return null;const l=[...new Set(t.active.map(e=>e.areaName??'Garden'))].join(', '),n=t.active.map(e=>e.to).sort().slice(-1)[0],a=t.active.every(e=>'Weather'===e.reason),d=a?`${l} closed for weather until ${n}`:t.active.map(i.pausedLine).join('. '),c=t.plan.areas.filter(e=>e.dogs&&!t.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(r.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:a?'row':'column',alignItems:a?'center':'stretch',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[a?(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}):null,(0,f.jsxs)(r.default,{style:{flex:a?1:void 0,minWidth:0},children:[(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",center:!a,colour:u.colours.blue,children:d}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",c.length?` Dogs can still sit in the ${c.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",style:a?void 0:{width:'100%'},testID:"garden-reopen",onPress:()=>t.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},1394,[843,17,1183,1172,385,85,995,998,862,863,804,777,1395,1398,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=C,_e.TimeGrid=S,_e.ScopePicker=T,_e.BlockNowSheet=M,_e.DatePicker=W,_e.AddBlockSheet=R,_e.PrivateFunctionSheet=L,_e.FutureBlocksList=F,_e.BlocksScreen=N,_e.DisplayBlocksScreen=E,_e.DisplayBlocksMenu=function({rid:e,r:t,now:s,by:o,onClose:n}){const[i,a]=(0,l.useState)('menu');return'now'===i?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'future'===i?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:!0,onClose:n}):'list'===i?(0,w.jsx)(E,{rid:e,r:t,now:s,by:o,onBack:n}):(0,w.jsxs)(p.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,w.jsx)(C,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>a('now')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>a('future')}),(0,w.jsx)(C,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>a('list')}),(0,w.jsx)(p.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=e(_r(_d[4])),i=e(_r(_d[5])),a=e(_r(_d[6])),r=e(_r(_d[7])),d=e(_r(_d[8])),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),k=_r(_d[18]),y=_r(_d[19]),j=_r(_d[20]),w=_r(_d[21]);const v=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],D=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],I=e=>{try{n.default.announceForAccessibility?.(e)}catch{}};function C({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:n,a11y:i,wide:r,accessibilityHint:d}){return(0,w.jsxs)(a.default,{testID:n,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityHint:d,accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:r?void 0:84,flexGrow:r?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?m.colours.gold:m.colours.border,backgroundColor:o?m.colours.gold:e?m.colours.goldTint:m.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:o?m.colours.onGold:m.colours.goldLight,center:!0,children:e}),t?(0,w.jsx)(p.T,{size:13,colour:o?m.colours.onGold:m.colours.muted,center:!0,children:t}):null]})}function S({from:e,to:t,min:s,max:o,onChange:n,testID:i="time-grid"}){const[a,r]=(0,l.useState)(e?'to':'from'),c=(0,b.quarterTimes)(s,o),u=t=>{if('from'===a||!e||(0,g.toMins)(t)<=(0,g.toMins)(e))return n(t,void 0),r('to'),void I(`From ${(0,b.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),I(`Block ${(0,b.rangeText)(e,t)}`)};return c.length?(0,w.jsxs)(d.default,{testID:i,style:{gap:6},children:[(0,w.jsxs)(p.T,{size:15,weight:"semibold",colour:m.colours.gold,children:['from'!==a&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,b.rangeText)(e,t??e)}`:'']}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,g.toMins)(s)>=(0,g.toMins)(e)&&(0,g.toMins)(s)<=(0,g.toMins)(t);return(0,w.jsx)(C,{testID:`${i}-${s.replace(':','')}`,label:(0,b.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===a?'From':'To'} ${(0,b.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>u(s)},s)})})]}):(0,w.jsx)(p.Muted,{children:"No times left today."})}function T({rid:e,value:t,onChange:s}){const n=(0,h.usePlan)(e),[i,a]=(0,l.useState)(!!t.tables?.length);return(0,w.jsxs)(d.default,{style:{gap:6},testID:"block-scope",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"scope-all",label:"All areas",selected:!t.areaId&&!t.tables?.length&&!i,onPress:()=>{a(!1),s({})}}),n.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:t.areaId===e.id,onPress:()=>{a(!1),s({areaId:e.id,areaName:e.name})}},e.id)),(0,w.jsx)(p.Chip,{testID:"scope-tables",label:"Some tables",selected:i,onPress:()=>{a(!0),s({tables:t.tables??[]})}})]}),i?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const l=!!t.tables?.includes(e.name);return(0,w.jsx)(p.Chip,{testID:`scope-table-${e.name}`,label:(0,o.tableNumbers)(e.name),selected:l,onPress:()=>s({tables:l?(t.tables??[]).filter(t=>t!==e.name):[...t.tables??[],e.name]})},e.id)})}):null]})}function B({value:e,note:t,onChange:s,onNote:o}){return(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:u.BLOCK_REASONS.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,w.jsx)(p.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function $({line:e,clashes:t,testID:s="block-confirm"}){return(0,l.useEffect)(()=>{I(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,w.jsxs)(d.default,{testID:s,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:m.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:m.colours.goldTint},children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,children:e}),t?(0,w.jsx)(p.T,{size:15,colour:m.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,w.jsx)(p.Muted,{children:"No bookings in this time yet."})]})}const P=e=>(0,b.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function M({rid:e,r:t,now:s,by:o,onClose:n,wide:i}){const a=(0,g.ymd)(s),r=(0,h.useDisplaySettings)(e),x=(0,b.openWindow)(t,a),k=(0,b.servicesOn)(t,a,r.serviceWindows),y=Math.max(x?.from??0,P(s)),j=(0,c.useBookings)(e),v=(0,h.usePlan)(e),[D,M]=(0,l.useState)({}),[W,R]=(0,l.useState)(!1),[L,z]=(0,l.useState)({}),[F,N]=(0,l.useState)(),[E,H]=(0,l.useState)(''),[A,O]=(0,l.useState)('pick'),[_,G]=(0,l.useState)(''),Y=!!x&&ye&&e.to>y?{from:(0,g.fromMins)(Math.max(e.from,y)),to:(0,g.fromMins)(e.to)}:null,U=q(k.lunch),K=q(k.dinner),Q=Y?[{id:'rest',label:'Rest of today',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(x.to)}},{id:'hour',label:'Next hour',w:{from:(0,g.fromMins)(y),to:(0,g.fromMins)(Math.min(x.to,y+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!D.from&&!!D.to&&(0,g.toMins)(D.to)>(0,g.toMins)(D.from)&&!(L.tables&&!L.tables.length),J=V?(0,b.confirmLine)({dates:[a],from:D.from,to:D.to,today:a,...L}):'',X=V?(0,b.bookingsInWindow)(j,[a],D.from,D.to,L,e=>v.tables.find(t=>t.name===e)?.areaId).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:i?760:void 0,testID:"block-now-sheet",children:'done'===A?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"block-now-done",children:_}),(0,w.jsx)(p.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===A?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:J,clashes:X}),(0,w.jsx)(p.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=u.useBlocks.getState().add({rid:e,date:a,from:D.from,to:D.to,reason:F,note:E.trim()||void 0,by:o,...L});(0,f.pushBlocksToWix)(e,[t.id],'add'),G(`Saved. ${J.replace(/^Block/,'Blocked')}.`),I(`Saved. ${J}`),O('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>O('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),Y?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,w.jsx)(C,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,b.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!W&&D.label===e.id,onPress:()=>{R(!1),M({...e.w,label:e.id})}},e.id)),(0,w.jsx)(C,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:W,onPress:()=>{R(!0),M({})}})]}):(0,w.jsx)(p.T,{colour:m.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),Y&&W?(0,w.jsx)(S,{min:y,max:x.to,from:D.from,to:D.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,Y?(0,w.jsx)(T,{rid:e,value:L,onChange:z}):null,Y?(0,w.jsx)(B,{value:F,note:E,onChange:N,onNote:H}):null,V?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"block-now-line",children:J}):null,(0,w.jsx)(p.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>O('confirm')})]})})}function W({value:e,end:t,range:s,min:o,onPick:n,testID:i="block-cal"}){const[r,c]=(0,l.useState)(()=>(e??o).slice(0,7)),u=(0,g.parseYmd)(`${r}-01`),h=(u.getDay()+6)%7,x=[...Array(h).fill(null)];for(let e=new Date(u);e.getMonth()===u.getMonth();e.setDate(e.getDate()+1))x.push((0,g.ymd)(e));const f=e=>{const t=(0,g.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,g.ymd)(t).slice(0,7))},k=o=>{if(!s||!e||t||of(-1)}),(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:(0,b.monthLabel)(`${r}-01`)}),(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,w.jsx)(d.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,w.jsx)(p.T,{size:13,colour:m.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,w.jsx)(d.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:x.map((s,l)=>{if(!s)return(0,w.jsx)(d.default,{style:{width:"14.285714285714286%",height:48}},`e${l}`);const n=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?m.colours.gold:m.colours.surface2,borderWidth:1,borderColor:r?m.colours.gold:m.colours.border,opacity:n?.3:1},children:(0,w.jsx)(p.T,{size:17,weight:"semibold",colour:r?m.colours.onGold:m.colours.text,children:String((0,g.parseYmd)(s).getDate())})})},s)})})]})}function R({rid:e,r:t,now:s,by:o,onClose:n,wide:i,edit:a,onEdit:r}){const x=(0,g.ymd)(s),k=(0,c.useBookings)(e),y=(0,h.usePlan)(e),[j,P]=(0,l.useState)(a?.date),[M,R]=(0,l.useState)(),[L,z]=(0,l.useState)(!1),[F,N]=(0,l.useState)(a?!!a.wholeDay:null),[E,H]=(0,l.useState)(a&&!a.wholeDay?a.from:void 0),[A,O]=(0,l.useState)(a&&!a.wholeDay?a.to:void 0),[_,G]=(0,l.useState)(a?{areaId:a.areaId,areaName:a.areaName,tables:a.tables}:{}),[Y,q]=(0,l.useState)(a?.reason),[U,K]=(0,l.useState)(a?.note??''),[Q,V]=(0,l.useState)('none'),[J,X]=(0,l.useState)([]),[Z,ee]=(0,l.useState)(),[te,se]=(0,l.useState)(!1),[oe,le]=(0,l.useState)('pick'),[ne,ie]=(0,l.useState)(''),ae=j?(0,b.openWindow)(t,j):null,re=ae?.from??540,de=ae?.to??1380,ce=j?(0,g.parseYmd)(j).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=j?a?[j]:(0,b.blockDates)(j,L?M:void 0,ue,Z):[],be=F?'00:00':E,ge=F?'23:59':A,me=!!j&&he.length>0&&null!=F&&!!be&&!!ge&&(0,g.toMins)(ge)>(0,g.toMins)(be)&&('none'===Q||!!Z)&&!(_.tables&&!_.tables.length),xe=(0,b.repeatText)(ue,Z),pe=me?(0,b.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!F,today:x,repeat:xe,..._}):'',fe=me?(0,b.bookingsInWindow)(k,he,be,ge,_,e=>y.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==a?.id).length:0;return(0,w.jsx)(p.Sheet,{visible:!0,onClose:n,title:a?'Edit block':'Add a block',maxWidth:i?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,w.jsxs)(d.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{size:19,weight:"semibold",colour:m.colours.gold,testID:"add-block-done",children:ne}),(0,w.jsx)(p.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,w.jsx)(p.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,w.jsxs)(d.default,{style:{gap:10},children:[(0,w.jsx)($,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,w.jsx)(p.Button,{testID:"add-block-save",label:a?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!F||void 0,reason:Y,note:U.trim()||void 0,areaId:_.areaId,areaName:_.areaName,tables:_.tables?.length?_.tables:void 0};if(a)return r?.({...t,date:j}),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,l=u.useBlocks.getState().addMany(he.map(l=>({rid:e,date:l,by:o,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,b.longDate)(he[0])} to ${(0,b.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,f.pushBlocksToWix)(e,l.map(e=>e.id),'add'),ie(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),I(`Saved. ${pe}`),le('done')}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),a?null:(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"add-single",label:"One date",selected:!L,onPress:()=>{z(!1),R(void 0)}}),(0,w.jsx)(p.Chip,{testID:"add-range",label:"A range of dates",selected:L,onPress:()=>{z(!0),V('none')}})]}),(0,w.jsx)(W,{value:j,end:M,range:L&&!a,min:x,onPick:(e,t)=>{P(e),R(t)}}),j?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-dates",children:L&&M?`${(0,b.longDate)(j)} to ${(0,b.longDate)(M)}`:(0,b.longDate)(j)}):null,j?(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===F,onPress:()=>N(!0)}),(0,w.jsx)(C,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ae?`Open ${(0,b.rangeText)((0,g.fromMins)(ae.from),(0,g.fromMins)(ae.to))}`:'Closed that day',selected:!1===F,onPress:()=>N(!1)})]}):null,j&&!1===F?(0,w.jsx)(S,{min:re,max:de,from:E,to:A,onChange:(e,t)=>{H(e),O(t)},testID:"add-grid"}):null,j?(0,w.jsx)(T,{rid:e,value:_,onChange:G}):null,j?(0,w.jsx)(B,{value:Y,note:U,onChange:q,onNote:K}):null,!j||a||L?null:(0,w.jsxs)(d.default,{style:{gap:6},testID:"add-repeat",children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(p.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,w.jsx)(p.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,w.jsx)(p.Chip,{testID:"repeat-last",label:`Last ${v[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:D.map((e,t)=>(0,w.jsx)(p.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,w.jsxs)(d.default,{style:{gap:6},children:[(0,w.jsx)(p.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,g.parseYmd)(j);t.setMonth(t.getMonth()+e);const s=(0,g.ymd)(t);return(0,w.jsx)(p.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,w.jsx)(p.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,w.jsx)(W,{value:Z,min:(0,b.addDays)(j,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,w.jsx)(p.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,w.jsx)(p.T,{size:16,weight:"semibold",colour:m.colours.goldLight,testID:"add-line",children:pe}):null,(0,w.jsx)(p.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function L({rid:e,now:o,by:n,onClose:i}){const a=(0,h.usePlan)(e),r=(0,c.useBookings)(e),x=(0,g.ymd)(o),[f,k]=(0,l.useState)(''),[y,j]=(0,l.useState)(x),[v,D]=(0,l.useState)('12:00'),[C,S]=(0,l.useState)('18:00'),[T,B]=(0,l.useState)(''),[P,M]=(0,l.useState)([]),[R,L]=(0,l.useState)('pick'),z={title:f,date:y,from:v,to:C,covers:T,areas:a.areas.filter(e=>P.includes(e.id))},F=(0,t.privateFunctionError)(z,x),N=z.areas.length?z.areas.map(e=>({areaId:e.id})):[{}],E=F?0:new Set(N.flatMap(e=>(0,b.bookingsInWindow)(r,[y],v,C,e,e=>a.tables.find(t=>t.name===e)?.areaId)).map(e=>e.id)).size;return(0,w.jsx)(p.Sheet,{visible:!0,title:"Private function",onClose:i,testID:"private-function-sheet",children:'done'===R?(0,w.jsxs)(d.default,{style:{gap:12},accessibilityLiveRegion:"polite",children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:"Private function saved"}),(0,w.jsxs)(p.T,{center:!0,children:[f.trim()," \xb7 ",T," Covers"]}),(0,w.jsx)(p.Muted,{center:!0,children:"Only new bookings are blocked. Existing bookings are kept. Other devices receive the function through venue sync."}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Chosen areas are blocked in CoverCharge only. Website bookings cannot mirror chosen-area blocks yet.':'Saved in CoverCharge. When venue sync is connected, the blocks list shows its Website bookings status.'}),(0,w.jsx)(p.Button,{label:"Done",onPress:i})]}):'check'===R?(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.T,{center:!0,size:22,weight:"bold",colour:m.colours.gold,children:f.trim()}),(0,w.jsxs)(p.T,{center:!0,children:[(0,b.longDate)(y)," \xb7 ",v,"\u2013",C," \xb7 ",T," Covers"]}),(0,w.jsx)(p.T,{center:!0,children:z.areas.length?z.areas.map(e=>e.name).join(', '):'Whole venue'}),(0,w.jsx)($,{line:"Block new bookings only. Existing bookings are kept.",clashes:E}),(0,w.jsx)(p.Muted,{center:!0,children:P.length?'Website bookings cannot mirror chosen-area blocks yet. Other areas remain bookable.':'When venue sync is connected, Website bookings receives this whole-venue booking block. Normal opening hours are unchanged.'}),(0,w.jsx)(p.Button,{testID:"private-function-save",label:"Save private function",onPress:()=>{F||(u.useBlocks.getState().addMany((0,t.privateFunctionBlocks)(z,e,n,(0,s.uuid)(),x)),L('done'),I('Private function saved. Existing bookings kept.'))},disabled:!!F}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Change",onPress:()=>L('pick')})]}):(0,w.jsxs)(d.default,{style:{gap:12},children:[(0,w.jsx)(p.Muted,{center:!0,children:"Whole venue or chosen areas, even on a normally closed day. Existing bookings are never changed."}),(0,w.jsx)(p.Field,{testID:"private-function-name",label:"Function name",accessibilityLabel:"Private function name",value:f,onChangeText:e=>k(e.slice(0,120))}),(0,w.jsx)(p.Field,{testID:"private-function-covers",label:"Expected Covers",accessibilityLabel:"Expected Covers for this private function",value:T,onChangeText:B,keyboardType:"number-pad"}),(0,w.jsx)(W,{min:x,value:y,onPick:j,testID:"private-function-date"}),(0,w.jsx)(p.Field,{testID:"private-function-from",label:"From (24-hour, HH:mm)",accessibilityLabel:"Private function start time, 24-hour HH colon mm",value:v,onChangeText:D}),(0,w.jsx)(p.Field,{testID:"private-function-to",label:"To (24-hour, HH:mm)",accessibilityLabel:"Private function end time, 24-hour HH colon mm",value:C,onChangeText:S}),(0,w.jsx)(p.T,{center:!0,weight:"semibold",children:"Where"}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:6},children:[(0,w.jsx)(p.Chip,{testID:"private-function-whole",label:"Whole venue",selected:!P.length,onPress:()=>M([])}),a.areas.map(e=>(0,w.jsx)(p.Chip,{testID:`private-function-area-${e.id}`,label:e.name,selected:P.includes(e.id),onPress:()=>M(P.includes(e.id)?P.filter(t=>t!==e.id):[...P,e.id])},e.id))]}),P.length?(0,w.jsx)(p.Muted,{center:!0,children:"Chosen areas: CoverCharge only. Website bookings cannot mirror chosen-area blocks yet."}):null,(0,w.jsx)(p.Muted,{center:!0,children:F??'Ready to check. Nothing is saved until you confirm.'}),(0,w.jsx)(p.Button,{testID:"private-function-check",label:"Check and save",disabled:!!F,onPress:()=>L('check')})]})})}function z({b:e,onEdit:t,onRemove:s,locked:o,hint:l}){const n=(0,b.whatText)(e);return(0,w.jsxs)(d.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:m.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:m.colours.surface2},accessible:!1,children:[(0,w.jsxs)(p.T,{size:17,weight:"semibold",colour:m.colours.goldLight,children:[(0,b.longDate)(e.date)," \xb7 ",(0,b.rangeText)(e.from,e.to,e.wholeDay)]}),(0,w.jsxs)(p.T,{children:[n,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.privateFunction?(0,w.jsx)(p.Muted,{children:e.areaId?'Chosen-area block: CoverCharge only, not mirrored to Website bookings.':`Website bookings: ${(0,f.websiteBlockStatus)(e.wix?.state)}`}):null,e.repeatText?(0,w.jsx)(p.Muted,{children:e.repeatText}):null,(0,w.jsxs)(p.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-edit-${e.id}`,onPress:t}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,b.longDate)(e.date)}`,accessibilityHint:l,disabled:o,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function F({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,u.useBlocks)(e=>e.blocks),r=(0,g.ymd)(s),c=(0,b.groupByMonth)(a,e,r,(0,g.hm)(s)),h=(0,l.useMemo)(()=>(0,b.ruleRows)(t,r),[t.id,r]),[x,v]=(0,l.useState)(null),[D,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(''),B=(0,j.useBookingWrite)(),$=e=>e.seriesId?a.filter(t=>t.seriesId===e.seriesId&&t.date>=r):[e],P=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,b.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>u.useBlocks.getState().remove(e.id,o)),(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),void C(null);(async()=>{for(const e of t){if(!((0,y.isLive)()?await(0,k.displayBlockEdit)(e.id,'remove',{},o):{ok:!0}).ok)return void T('Could not remove it. Try again.');(0,y.isLive)()||u.useBlocks.getState().remove(e.id,o)}(0,f.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),T(`${s}. Bookings are open again for that time.`),I(s),C(null)})()},M=(t,s)=>{if(!n)return u.useBlocks.getState().update(t.id,s,o),void(0,f.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,y.isLive)()?await(0,k.displayBlockEdit)(t.id,'edit',s,o):{ok:!0}).ok?((0,y.isLive)()||u.useBlocks.getState().update(t.id,s,o),(0,f.pushBlocksToWix)(e,[t.id],'edit'),T(`Block on ${(0,b.longDate)(s.date??t.date)} changed.`)):T('Could not change it. Try again.')})()},W=[...new Set([...c.map(e=>e.month),...h.map(e=>(0,b.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,w.jsxs)(d.default,{style:{gap:12},testID:"future-blocks",children:[S?(0,w.jsx)(d.default,{accessibilityLiveRegion:"polite",children:(0,w.jsx)(p.T,{colour:m.colours.goldLight,testID:"fb-msg",children:S})}):null,c.length?null:(0,w.jsx)(p.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),W.map(e=>{const t=c.find(t=>t.month===e)?.items??[],s=h.filter(t=>(0,b.monthLabel)(t.date)===e);return(0,w.jsxs)(d.default,{style:{gap:8},children:[(0,w.jsx)(p.T,{size:18,weight:"semibold",colour:m.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,w.jsx)(z,{b:e,locked:!B.ok,hint:B.hint,onEdit:()=>{B.ok&&v(e)},onRemove:()=>{B.ok&&C(e)}},e.id)),s.map(e=>(0,w.jsxs)(d.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:m.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[(0,b.longDate)(e.date)," \xb7 ",e.name]}),(0,w.jsxs)(p.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),x?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,edit:x,onClose:()=>v(null),onEdit:e=>M(x,e)}):null,D?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>C(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,w.jsx)(p.T,{size:17,children:`${(0,b.longDate)(D.date)}, ${(0,b.rangeText)(D.from,D.to,D.wholeDay)}, ${(0,b.whatText)(D).toLowerCase()}.`}),(0,w.jsx)(p.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,w.jsx)(p.Button,{testID:"fb-remove-one",label:$(D).length>1?'Remove this date only':'Remove block',onPress:()=>P([D])}),$(D).length>1?(0,w.jsx)(p.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(D).length} in this series`,onPress:()=>P($(D))}):null,(0,w.jsx)(p.Button,{kind:"ghost",label:"Keep it",onPress:()=>C(null)})]}):null]})}function N({rid:e,r:t,now:s,by:o,display:n,wide:i}){const a=(0,j.useBookingWrite)(),[r,c]=(0,l.useState)(null);return(0,w.jsxs)(d.default,{style:{gap:12},testID:"blocks-screen",children:[(0,w.jsx)(p.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,w.jsxs)(d.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,w.jsx)(C,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('now')}}),(0,w.jsx)(C,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('add')}})]}),n?null:(0,w.jsx)(C,{wide:!0,testID:"blocks-function",label:"Private function",sub:"Whole venue or chosen areas",disabled:!a.ok,accessibilityHint:a.hint,onPress:()=>{a.ok&&c('function')}}),(0,w.jsx)(p.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,w.jsx)(F,{rid:e,r:t,now:s,by:o,display:n,wide:i}),'now'===r?(0,w.jsx)(M,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null,'function'===r?(0,w.jsx)(L,{rid:e,now:s,by:o,onClose:()=>c(null)}):null,'add'===r?(0,w.jsx)(R,{rid:e,r:t,now:s,by:o,wide:i,onClose:()=>c(null)}):null]})}function E({rid:e,r:t,now:s,by:o,onBack:l}){return(0,x.useBackLayer)(!0,l),(0,w.jsx)(i.default,{visible:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(d.default,{style:{flex:1,backgroundColor:m.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(x.BackButton,{onPress:l,testID:"display-blocks-back"}),(0,w.jsx)(p.T,{size:22,weight:"semibold",colour:m.colours.gold,children:"Block bookings"}),(0,w.jsx)(d.default,{style:{width:96}})]}),(0,w.jsx)(r.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,w.jsx)(N,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1395,[1396,854,843,17,264,378,385,278,85,858,995,998,1397,863,804,1026,777,1398,1350,899,1338,8]); +__d(function(g,r,i,_a,m,e,_d){"use strict";function t(t,o){if(t.title.trim().length<2||t.title.trim().length>120)return'Enter a function name (2\u2013120 characters).';const n=new Date(`${t.date}T12:00:00Z`);if(!/^\d{4}-\d{2}-\d{2}$/.test(t.date)||t.date/^([01]\d|2[0-3]):[0-5]\d$/.test(t);return!a(t.from)||!a(t.to)||t.to<=t.from?'Use 24-hour times, with the end after the start.':!/^\d+$/.test(t.covers)||+t.covers<1||+t.covers>99999?'Enter the expected number of Covers.':null}Object.defineProperty(e,'__esModule',{value:!0}),e.privateFunctionError=t,e.privateFunctionBlocks=function(o,n,a,s,c){const d=t(o,c);if(d)throw new Error(d);const u={id:s,title:o.title.trim(),covers:Number(o.covers)};return(o.areas.length?o.areas:[void 0]).map(t=>({rid:n,by:a,date:o.date,from:o.from,to:o.to,reason:'Private event',note:`${u.title} \xb7 ${u.covers} Covers`,privateFunction:u,...t?{areaId:t.id,areaName:t.name}:{}}))}},1396,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1397,[862,863,861]); +__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')},1398,[805,998,928,899]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_GRAPH_CHROME",{enumerable:!0,get:function(){return j}}),_e.DayGraph=function({todays:e,open:j,close:T,now:b,turnBase:v,blocks:w=[],height:M=150,forecastNote:k,emptyText:D,past:L,closed:I,compact:$=!1,dense:C=!1,bare:A=!1,fill:z=!1,fit:O=!1,tight:_=!1,live:H=!1,onChrome:S}){const[F,P]=(0,t.useState)(0),[E,R]=(0,t.useState)(0),[N,B]=(0,t.useState)(0),[W,X]=(0,t.useState)(0);s.default.useEffect(()=>{S&&O&&W&&S(Math.ceil((A?4:C?2:10)+N+W+(A?2:6)+2))},[S,O,N,W,A,C]);const U=j.getTime()-18e5,G=T.getTime()+36e5,Y=(0,t.useMemo)(()=>(0,f.coverCurve)(e,new Date(U),new Date(G),v),[e,U,G,v]),V=60*j.getHours()+j.getMinutes(),K=60*T.getHours()+T.getMinutes(),Z=(0,t.useMemo)(()=>(0,p.chartBands)(w,V,K),[w,V,K]),q=new Date(j);q.setHours(0,0,0,0);const J=e=>q.getTime()+6e4*e,Q=Math.max(8,...Y.map(e=>e.covers)),ee=Y.reduce((e,t)=>!t.covers||(0,p.minuteInsideVenueBlock)(60*new Date(t.t).getHours()+new Date(t.t).getMinutes(),Z)?e:!e||t.covers>e.covers?{t:t.t,covers:t.covers}:e,null),te=O&&E?Math.max(24,Math.floor(E)):Math.max(48,M-m.AXIS_BAND),se=m.CHART_PAD_L,ie=m.CHART_PAD_R,oe=C?18:22,ne=Math.max(10,F-se-ie),le=Math.max(10,te-oe-14),re=e=>se+(e-U)/(G-U)*ne,ae=e=>oe+le-e/(1.15*Q)*le,he=(0,m.yTicks)(Q),de=(0,m.fitYTicks)(he,ae,te,13),ue=(0,m.nowLineVisible)({now:b,open:j,close:T,live:H,past:L,closed:I}),ce=b.getTime(),ge=ue&&Y.length?(0,m.splitCurve)(Y,ce):{before:Y,after:[]},xe=e=>e.map((e,t)=>`${t?'L':'M'}${re(e.t).toFixed(1)},${ae(e.covers).toFixed(1)}`).join(' '),me=[];for(let e=new Date(U);e.getTime()<=G;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=U&&t.getTime()<=G&&me.push(t.getTime())}const pe=H?(0,m.seatedNowCovers)(e,e[0]?.date??''):0,fe=Math.min(G,Math.max(U,b.getTime())),ye=I?null:H?{t:fe,covers:pe,text:(0,m.seatedNowText)(pe)}:ee,je=F?(0,m.layoutChart)({width:F,height:te,t0:U,t1:G,hours:me,busiest:ye}):{hours:[],busiest:null},Te=xe(Y),be=ue?xe(ge.before):Te,ve=ue?xe(ge.after):'',we=z&&Te&&Y.length>1?`${Te} L${re(Y[Y.length-1].t).toFixed(1)},${ae(0).toFixed(1)} L${re(Y[0].t).toFixed(1)},${ae(0).toFixed(1)} Z`:'',Me=(0,i.coversFour)(e,e[0]?.date??''),ke=`Total ${Me.total} ${1===Me.total?'Cover':'Covers'}`,De=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length,Le=je.busiest?.text??(I?'':H?(0,m.seatedNowText)(pe):ee?(0,m.busiestText)(ee.t,ee.covers):''),Ie=Z.map(e=>e.spoken).join('. '),$e=ue&&T.getTime()>j.getTime()?Math.max(0,Math.min(100,Math.round((ce-j.getTime())/(T.getTime()-j.getTime())*100))):null,Ce=!I&&ee&&ee.covers?(0,m.peakOccupancyText)(ee.t,ee.covers):'',Ae=`Covers through the day. Open ${(0,u.hm)(j)}. Close ${(0,u.hm)(T)}.${Ce?` ${Ce}.`:''}${Le?` ${Le}.`:''}${ue?` It is ${(0,u.hm)(b)}. About ${$e} percent of the way through the day.`:''}${Ie?` ${Ie}.`:''}`,ze=(0,u.hm)(b),Oe=Math.max(44,12*ze.length*.7+16),He=Math.max(se+2,Math.min(Math.max(0,F-ie-Oe),re(ce)-Oe/2)),Se=Math.max(2,Math.min(te-22,oe+le-22)),Fe=s.default.useId().replace(/:/g,'');return(0,y.jsxs)(o.default,{testID:"day-graph",style:[d.look.panel,O?{flex:1,minHeight:0}:null,{overflow:'visible',paddingTop:A?4:C?2:10,paddingBottom:A?2:6,backgroundColor:c.colours.bg}],children:[(0,y.jsxs)(o.default,{testID:"day-graph-head",onLayout:e=>B(e.nativeEvent.layout.height),children:[A?null:$?(0,y.jsxs)(o.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,y.jsx)(h.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,y.jsx)(h.T,{center:!0,size:14,colour:c.colours.muted,testID:"day-graph-parties",children:ke}),Ce?(0,y.jsx)(h.T,{center:!0,size:13,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,children:Ce}):null]}):(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8},children:[(0,y.jsx)(h.T,{size:C?14:15,weight:"semibold",style:{flexShrink:1},children:"Covers through the day"}),(0,y.jsx)(h.T,{size:12,colour:c.colours.muted,testID:"day-graph-parties",children:ke})]}),A||_?null:I?k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:2,children:k}):null:(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingHorizontal:14,gap:8,paddingTop:2},children:[(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Open ",(0,u.hm)(j)]}),Ce&&!$?(0,y.jsx)(h.T,{size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,center:!0,style:{flex:1,minWidth:0},children:Ce}):k?(0,y.jsx)(h.T,{size:11,colour:"#8C8477",numberOfLines:1,style:{flex:1,textAlign:'center'},children:k}):(0,y.jsx)(o.default,{style:{flex:1}}),(0,y.jsxs)(h.T,{size:12,colour:c.colours.goldLight,children:["Close ",(0,u.hm)(T)]})]}),A||_||$||!k||!Ce?null:(0,y.jsx)(h.T,{size:11,colour:"#8C8477",center:!0,numberOfLines:1,style:{paddingHorizontal:14},children:k}),A||!_||!Ce||$?null:(0,y.jsx)(h.T,{center:!0,size:12,colour:c.colours.goldLight,testID:"day-graph-peak",numberOfLines:1,style:{paddingHorizontal:14},children:Ce})]}),(0,y.jsxs)(o.default,{testID:"day-graph-plot",accessible:!0,accessibilityLabel:Ae,onLayout:e=>{P(e.nativeEvent.layout.width),O&&R(e.nativeEvent.layout.height)},style:O?{flexGrow:1,flexShrink:1,flexBasis:Math.max(48,M-m.AXIS_BAND),minHeight:24,overflow:'hidden',position:'relative'}:{height:te,minHeight:te,position:'relative',overflow:'hidden'},children:[F?(0,y.jsxs)(l.default,{width:F,height:te,children:[(0,y.jsxs)(n.Defs,{children:[(0,y.jsxs)(n.Pattern,{id:`${Fe}-venue`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"1.4"})]}),(0,y.jsxs)(n.Pattern,{id:`${Fe}-area`,patternUnits:"userSpaceOnUse",width:"8",height:"8",children:[(0,y.jsx)(n.Rect,{width:"8",height:"8",fill:"#2A2622",fillOpacity:"0.35"}),(0,y.jsx)(n.Line,{x1:"0",y1:"8",x2:"8",y2:"0",stroke:"#6A6258",strokeWidth:"0.8"})]})]}),Z.map((e,t)=>(0,y.jsx)(n.Rect,{x:re(J(e.fromMin)),y:oe,width:Math.max(3,re(J(e.toMin))-re(J(e.fromMin))),height:le,fill:`url(#${Fe}-${e.strength})`},`${e.fromMin}-${t}`)),he.map(e=>(0,y.jsx)(n.Line,{x1:se,x2:se+ne,y1:ae(e),y2:ae(e),stroke:c.colours.muted,strokeWidth:1,opacity:.28},`grid-${e}`)),ue?(0,y.jsx)(n.Rect,{testID:"day-graph-elapsed",x:re(j.getTime()),y:oe,width:Math.max(0,re(ce)-re(j.getTime())),height:le,fill:c.colours.gold,opacity:.12}):null,we?(0,y.jsx)(n.Path,{d:we,fill:"#3A2F1E",stroke:"none"}):null,be?(0,y.jsx)(n.Path,{d:be,stroke:c.colours.gold,strokeWidth:2.5,fill:"none"}):null,ve?(0,y.jsx)(n.Path,{d:ve,stroke:c.colours.gold,strokeWidth:2.5,fill:"none",opacity:.38}):null,I?null:[j,T].map((e,t)=>(0,y.jsx)(n.Line,{x1:re(e.getTime()),x2:re(e.getTime()),y1:oe,y2:oe+le,stroke:c.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"},`service-${t}`)),ue?(0,y.jsx)(n.Line,{testID:"day-graph-now",x1:re(ce),x2:re(ce),y1:oe,y2:oe+le,stroke:c.colours.gold,strokeWidth:2}):null,je.busiest?(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:je.busiest.x+je.busiest.w/2,y:je.busiest.y+je.busiest.h-2,fill:c.colours.gold,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:je.busiest.text}):null,De?null:(0,y.jsx)(n.Text,{fontFamily:"Poppins_500Medium",x:se+ne/2,y:oe+le/2,fill:c.colours.muted,fontSize:(0,x.soutersFont)(13),textAnchor:"middle",children:D??'No bookings yet today'})]}):null,F?de.map(e=>(0,y.jsx)(o.default,{testID:"day-graph-ytick",pointerEvents:"none",style:{position:'absolute',left:0,width:se-4,top:e.top,alignItems:'flex-end',justifyContent:'flex-start'},children:(0,y.jsx)(h.T,{size:e.font,numberOfLines:1,colour:c.colours.muted,style:{textAlign:'right'},children:String(e.value)})},`yt-${e.value}`)):null,F&&ue&&te>=m.YTICK_MIN_PLOT?(0,y.jsx)(o.default,{testID:"day-graph-now-label",pointerEvents:"none",style:{position:'absolute',left:He,top:Se,minWidth:Oe,height:20,paddingHorizontal:8,borderRadius:10,backgroundColor:c.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:c.colours.bg,center:!0,numberOfLines:1,children:ze})}):null]}),(0,y.jsxs)(o.default,{testID:"day-graph-axis",onLayout:e=>X(e.nativeEvent.layout.height),style:{minHeight:m.AXIS_BAND,flexShrink:0,position:'relative',justifyContent:'center',paddingBottom:2},children:[(0,y.jsx)(o.default,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",pointerEvents:"none",style:{opacity:0,alignSelf:'flex-start'},children:(0,y.jsx)(h.T,{size:m.AXIS_FONT,numberOfLines:1,children:"20"})}),je.hours.map(e=>{const t=Math.min(Math.max(e.w,40),Math.max(e.w,F)),s=e.x+e.w/2-t/2,i=Math.max(0,Math.min(Math.max(0,F-t),s));return(0,y.jsx)(o.default,{pointerEvents:"none",style:{position:'absolute',left:i,width:t,top:0,bottom:0,alignItems:i>s+.5?'flex-start':in.fromMin-t.fromMin||n.toMin-t.toMin||(n.strength===t.strength?0:'area'===n.strength?-1:1));const l=[];for(const n of f){const t=l[l.length-1];t&&t.strength===n.strength&&n.fromMin<=t.toMin?(t.toMin=Math.max(t.toMin,n.toMin),t.spoken.includes(n.spoken)||(t.spoken=`${t.spoken}. ${n.spoken}`)):l.push({...n})}return l},e.blockedHours=function(n){const t=new Set;for(const o of n)if('venue'===o.strength)for(let n=Math.floor(o.fromMin/60);60*n=30&&t.add(n)}return[...t].sort((n,t)=>n-t)},e.minuteInsideVenueBlock=function(n,t){return t.some(t=>'venue'===t.strength&&n>=t.fromMin&&n{const t=/^(\d{1,2}):(\d{2})/.exec(n);return t?60*Number(t[1])+Number(t[2]):null},t=n=>`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`;function o(n,o,s){const a=`${t(o)} to ${t(s)}`,c=n.privateFunction?.title?.trim();if(!n.areaId&&!n.tables?.length){const n=`Bookings blocked ${a}`;return{strength:'venue',spoken:c?`${n}, ${c}`:n}}const u=`${n.areaName?.trim()||(n.tables?.length?'Tables':'Area')} blocked ${a}`;return{strength:'area',spoken:c?`${c}, ${u}`:u}}function s(t,o,s){const a=new Set;for(const c of t){if(c.removedAt||!c.areaId)continue;const t=c.wholeDay?0:n(c.from),u=c.wholeDay?1440:n(c.to);null!=t&&null!=u&&(t<=o&&u>=s&&a.add(c.areaId))}return a}},1400,[]); +__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},1401,[1076]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CANCEL_TINT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CANCEL_BORDER",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CANCEL_INK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"CANCEL_MUTED",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"cancelWhen",{enumerable:!0,get:function(){return d}}),e.cancelledBy=u,e.cancelItem=b,e.cancellationsFor=function(n,t,o){return n.filter(n=>n.date===t&&('cancelled'===n.status||'noshow'===n.status)).sort((n,t)=>n.time.localeCompare(t.time)||n.name.localeCompare(t.name)).map(n=>b(n,o(n)))},Object.defineProperty(e,"cancellationsHeading",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"cancellationsEmpty",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"cancellationsCounts",{enumerable:!0,get:function(){return f}});var n=r(_d[0]),t=r(_d[1]);const o=n=>n?n.split('+').map(n=>n.trim()).filter(Boolean):[],i='#17140F',a='#6B5A35',l='#F3E7CC',c='#B8AA8A',s={online:'Website',phone:'Phone','in-person':'In person','walk-in':'Walk-in',email:'Email','third-party':'Third party'},d=(n,t)=>{if(!n)return null;const o=new Date(n);if(Number.isNaN(o.getTime()))return null;const i=o.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'});return o.toLocaleDateString('en-CA',{timeZone:'Europe/London'})===t?i:`${o.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'Europe/London'})}, ${i}`};function u(n){const t=n;if('noshow'===n.status)return t.cancelled?.by?`Marked no-show by ${t.cancelled.by}`:'Marked no-show';if(t.cancelled?.by)return t.cancelled.by;const o=!!t.wix?.status&&/CANCEL|DECLIN/i.test(t.wix.status);return o&&t.wix?.archived?'Cancelled and archived in Website bookings':o?'Cancelled in Website bookings':(n.tags??[]).some(n=>n.endsWith(': deposit not paid'))||'PAYMENT_INFORMATION_PENDING'===t.wix?.status?'Website booking not finished (deposit not paid)':t.wix?.archived?'Archived in Website bookings':'Not recorded'}function b(i,a){const l=i,c=o(i.table??l.cancelled?.table??void 0),b=c.length?`Table ${(0,n.tableNumbers)(c.join('+'))}`:'No table',p=`${i.partySize} ${1===i.partySize?'person':'people'}`,h=d(l.cancelled?.at??(l.wix?l.wix.updatedDate:null),i.date),f=u(i),w=i.walkIn?'Walk-in':s[i.source??'']??(l.wix?'Website':'Not recorded'),y=(0,t.allergyLine)(i),C='noshow'===i.status,N=`${C?'No-show':'Cancelled'}: ${a}, ${y?`allergy noted: ${y}, `:''}${p}, was ${i.time}, ${b.toLowerCase()}. ${f}${h?` at ${h}`:''}.`;return{id:i.id,date:i.date,name:a,people:p,time:i.time,table:b,tables:c,walkIn:!!i.walkIn,by:f,when:h,source:w,notes:(i.notes??'').trim(),allergy:y,spoken:N,kind:C?'noshow':'cancelled'}}const p=n=>`Cancellations & no-shows ${n}`,h=(n="today")=>`No cancellations or no-shows ${n}.`,f=n=>{const t=n.filter(n=>'noshow'===n.kind).length,o=n.length-t;return`${o} ${1===o?'cancellation':'cancellations'} \xb7 ${t} ${1===t?'no-show':'no-shows'}`}},1402,[843,1380]); +__d(function(g,r,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:b="today",testID:y="display-cancellations"}){const[p,C]=(0,l.useState)(null),j=(0,s.cancellationsHeading)(e.length);return(0,u.jsxs)(o.default,{testID:y,style:{marginTop:14,borderRadius:12,backgroundColor:s.CANCEL_TINT,borderWidth:1,borderColor:s.CANCEL_BORDER,padding:10,gap:6},children:[(0,u.jsxs)(o.default,{accessible:!0,accessibilityRole:"header",accessibilityLabel:e.length?`${j}: ${(0,s.cancellationsCounts)(e)}. Not counted in Covers.`:`Cancellations and no-shows: none ${b}.`,style:{alignItems:'center',gap:2},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:c.colours.gold,center:!0,testID:"cancellations-head",children:j}),e.length?(0,u.jsx)(n.T,{size:14,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-counts",children:(0,s.cancellationsCounts)(e)}):null]}),e.length?e.map(e=>(0,u.jsxs)(t.default,{testID:`cancel-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.spoken,accessibilityHint:"Opens the details. Read only.",onPress:()=>C(e),dataSet:{centreExempt:'list-row'},style:({pressed:e})=>({minHeight:56,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderTopWidth:1,borderColor:'rgba(214,180,106,0.18)',backgroundColor:e?'#241F16':'transparent'}),children:[(0,u.jsxs)(o.default,{style:{flexDirection:'row',gap:10,alignItems:'flex-start'},children:[(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{width:58,textDecorationLine:'line-through'},children:e.time}),(0,u.jsx)(n.T,{size:17,weight:"semibold",colour:s.CANCEL_INK,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:e.name}),(0,u.jsx)(o.default,{testID:`cancel-kind-${e.id}`,style:{paddingHorizontal:8,paddingVertical:2,borderRadius:999,borderWidth:1,borderColor:'noshow'===e.kind?c.colours.amber:s.CANCEL_BORDER},children:(0,u.jsx)(n.T,{size:13,weight:"semibold",colour:'noshow'===e.kind?c.colours.amber:s.CANCEL_MUTED,children:'noshow'===e.kind?'No-show':'Cancelled'})}),e.allergy?(0,u.jsx)(o.default,{style:{paddingTop:1},children:(0,u.jsx)(h.AllergyIcon,{text:e.allergy,size:20,colour:"#D6A23A",ink:"#17140F",testID:`cancel-allergy-${e.id}`})}):null]}),(0,u.jsxs)(n.T,{size:15,colour:s.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,u.jsx)(n.T,{size:15,colour:s.CANCEL_MUTED,center:!0,testID:"cancellations-empty",children:(0,s.cancellationsEmpty)(b)}),p?(0,u.jsx)(x,{c:p,onClose:()=>C(null)}):null]})},_e.CancelDetail=x;var l=r(d[0]),t=e(r(d[1])),o=e(r(d[2])),n=r(d[3]),s=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]);function b({k:e,v:l}){return(0,u.jsxs)(o.default,{accessible:!0,accessibilityLabel:`${e}: ${l}`,style:{flexDirection:'row',gap:10,paddingVertical:6,borderBottomWidth:1,borderColor:c.colours.hairline},children:[(0,u.jsx)(n.T,{size:16,colour:c.colours.muted,style:{width:130},children:e}),(0,u.jsx)(n.T,{size:16,style:{flex:1,minWidth:0,flexWrap:'wrap'},children:l})]})}function x({c:e,onClose:l}){return(0,u.jsxs)(n.Sheet,{visible:!0,onClose:l,title:`${'noshow'===e.kind?'No-show':'Cancelled'} \xb7 ${e.name}`,maxWidth:560,testID:"cancel-detail",children:[(0,u.jsxs)(o.default,{testID:"cancel-detail-body",style:{gap:2},children:[(0,u.jsx)(b,{k:"Name",v:e.name}),(0,u.jsx)(b,{k:"Party",v:e.people}),e.allergy?(0,u.jsx)(b,{k:"Allergies",v:e.allergy}):null,(0,u.jsx)(b,{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,u.jsx)(b,{k:"Table",v:e.table}),(0,u.jsx)(b,{k:'noshow'===e.kind?'No-show':'Cancelled by',v:e.by}),(0,u.jsx)(b,{k:"When",v:e.when??'Not recorded'}),(0,u.jsx)(b,{k:"Booked by",v:e.source}),(0,u.jsx)(b,{k:"Notes",v:e.notes||'None'})]}),(0,u.jsx)(n.T,{size:14,colour:c.colours.muted,center:!0,children:"Read only. Not counted in Covers. Phone numbers stay in the Managers app."})]})}},1403,[17,385,85,777,1402,804,1358,8]); +__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]},1404,[17,85,884,777,1172,863,804,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"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'},1405,[17,1172,385,85,409,777,8]); +__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()}}},1406,[17,1005,876,926,816,1006,916,1350,1066]); +__d(function(g,_r,i,a,_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),m=(0,c.useSync)(e=>e.message),[T,E]=(0,o.useState)(!1),[R,y]=(0,o.useState)(!1),[j,D]=(0,o.useState)(''),[f,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),D(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),D(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=T||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,{testID:"pair-panel",style:{width:'100%',maxWidth:460,gap:12,alignItems:'stretch'},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",center:!0,accessibilityRole:"header",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{center:!0,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,{center:!0,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."}),m?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,center:!0,children:m}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:j,onChangeText:D,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456",style:{textAlign:'center',letterSpacing:1}}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,center:!0,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:f?'Pairing\u2026':'Pair',disabled:f||!j.trim(),onPress:()=>k(j)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),y(!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,'')}},1407,[805,813,857,17,219,385,85,409,899,804,777,1346,1408,8]); +__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}})()},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 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]})}},1409,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1410,[13,17,1411,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},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 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]})}},1412,[13,17,856,1413,8]); -__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1413,[1414,1418,813,912,1072,1419,1203,1204,1028,1025,1026,1420,1422,1425,1153,891,978,1427,975,880,1031,1032,1428,914,1008,915,17,1155,1231,1235,1197,356,385,278,85,409,19,777,857,876,804,1161,1429,1066,1084,1086,1081,1027,1010,1057,1436,1437,1438,1446,1447,920,219,1236,1176,1182,1443,1196,1193,1452,1179,878,1206,1207,884,776,899,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1414,[812,17,1018,378,85,1108,1109,1360,1393,777,995,998,863,804,1057,999,1415,1416,1020,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1415,[812,17,385,85,777,804,998,805,999,856,899,8]); -__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1416,[17,85,777,998,1417,842,804,1038,928,8]); -__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):''},1417,[]); -__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1418,[17,85,777,1057,899,8]); -__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1419,[843,17,85,777,845,851,1154,858,853,804,8]); -__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1420,[899,17,264,219,85,1275,777,1252,1255,804,1421,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1421,[17,219,85,777,1252,8]); -__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1422,[17,779,85,777,845,1252,1423,1424,804,8]); -__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'},1423,[845]); -__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()})},1424,[899,1423,1255]); -__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1425,[805,1426,17,85,777,851,1252,1253,1254,899,1255,804,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1426,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1427,[219,976]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1428,[17,85,777,804,914,1022,899,8]); -__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1429,[805,1426,1095,1262,1430,812,822,1117,1118,1091,1122,1431,1114,1119,1401,1402,1057,1338,996,1120,1089,841,1380,1125,1433,1231,1434,1393,1078,1055,1090,17,85,777,1358,858,845,851,863,1316,804,1178,1098,1115,998,1355,1062,1162,1435,1222,899,1180,1398,862,8]); -__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1430,[806,17,85,777,899,1266,8]); -__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1431,[17,385,85,1432,899,928,804,777,8]); -__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1432,[]); -__d(function(_g,_r,i,a,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'}):''},1433,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";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])},1434,[17,385,1172,777,804,8]); -__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1435,[17,85,864,858,848,804,777,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1436,[17,1394,1057,8]); -__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])},1437,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); -__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1438,[820,896,1439,17,219,85,777,816,876,895,1000,897,899,1445,804,880,1163,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1439,[812,891,1140,899,780,1220,1222,17,264,362,219,385,85,409,864,777,858,1231,876,851,863,804,1178,1057,853,1055,1440,1161,1443,1444,1139,1146,1145,1008,839,1142,1149,1215,8]); -__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1440,[886,779,816,813,822,862,1039,1441,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1215,8]); -__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})({})},1441,[482,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 t}});var t={}},1442,[]); -__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1443,[812,17,1245,1026,854,362,385,85,777,876,851,863,804,1178,1057,1215,8]); -__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1444,[978,17,385,85,777,876,804,1057,1161,899,8]); -__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1445,[]); -__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)','')},1446,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); -__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1447,[1448,17,219,24,85,856,1449,920,804,1451,777,899,922,880,1069,918,876,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},1448,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1449,[17,278,85,777,857,804,1450,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1450,[]); -__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1451,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); -__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1452,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1440,1162,860,1180,853,1178,884,1355,998,843,1115,1193,1200,1071,8]); -__d(function(g,r,i,a,m,e,d){"use strict";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]})}},1453,[13,17,856,8]); -__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1454,[1455,899,778,1407,1457,995,13,1484,479,17,368,319,219,24,85,805,857,1065,856,1486,19,858,998,876,804,1447,920,988,1489,1490,1028,1104,880,1008,914,1492,1377,8,1493,1494,1495,1496]); -__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1455,[880,812,17,219,366,85,777,1456,899,804,1182,920,876,909,8]); -__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"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}}},1456,[]); -__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])},1457,[1458,1481,1483]); -__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)}}},1458,[198,1459,1462,1476,1477,1478,1479,1480]); -__d(function(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}},1459,[198,1460]); -__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}},1460,[1461]); -__d(function(g,r,i,a,m,e,d){},1461,[]); -__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)}},1462,[1463,198,1459,1476,1477]); -__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]}})})},1463,[1464,1465,1475]); -__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()}})}},1464,[1465,1469,1474]); -__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}}},1465,[198,355,1466,1470,1471,1472,1473,1469,1474]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.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}},1466,[198,1467,322,263,1468,1469]); -__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])},1467,[487]); -__d(function(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}}},1468,[198,322]); -__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},1469,[]); -__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}},1470,[]); -__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}},1471,[]); -__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])},1472,[1470]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1473,[]); -__d(function(g,r,i,a,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},1474,[355,1468]); -__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])},1475,[17,1465]); -__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}},1476,[1463,198]); -__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])},1477,[1463,1476]); -__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}},1478,[1459]); -__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])},1479,[198,1459,1462,1460]); -__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})({})},1480,[]); -__d(function(g,r,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]))},1481,[198,37,1482]); -__d(function(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')},1482,[198]); -__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]}},1483,[17,1458]); -__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]}})})},1484,[1485]); -__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(){}},1485,[]); -__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1486,[17,24,85,409,777,857,920,899,880,805,804,1487,1488,8]); -__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1487,[]); -__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])},1488,[17,85,777,804,8]); -__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()})},1489,[905,868,867,899]); -__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1490,[813,779,17,974,385,85,856,899,976,804,777,1346,971,880,1491,8]); -__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1491,[17,1415,385,85,899,804,777,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1492,[]); -__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"},1493,[]); -__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"},1494,[]); -__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"},1495,[]); -__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"},1496,[]); -__d(function(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]})}},1497,[13,17,856,8]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1498,[1499]); -__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},1499,[8,1500,574]); -__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}))}}},1500,[17,155]); -__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1501,[]); -__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})}}},1502,[8,482,17,253,634]); +__d(function(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]})}},1410,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},1411,[13,17,1412,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},1412,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),f=r(d[3]),u=r(d[4]);function c(){return(0,n.canShow)('staff')?(0,u.jsx)(f.StaffApp,{}):(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1413,[13,17,856,1414,8]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffApp=function(){return(0,je.jsx)(ee.StaffAppCtx.Provider,{value:!0,children:(0,je.jsx)(Ae,{})})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),n=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),f=_r(d[10]),p=_r(d[11]),b=_r(d[12]),y=_r(d[13]),x=_r(d[14]),k=_r(d[15]),j=_r(d[16]),w=_r(d[17]),v=_r(d[18]),C=_r(d[19]),S=_r(d[20]),T=_r(d[21]),M=_r(d[22]),R=_r(d[23]),A=_r(d[24]),B=_r(d[25]),P=_r(d[26]),I=_r(d[27]),O=_r(d[28]),W=_r(d[29]),L=_r(d[30]),z=e(_r(d[31])),E=e(_r(d[32])),H=e(_r(d[33])),_=e(_r(d[34])),D=e(_r(d[35])),N=_r(d[36]),F=_r(d[37]),U=_r(d[38]),V=_r(d[39]),$=_r(d[40]),G=_r(d[41]),Y=_r(d[42]),Q=_r(d[43]),J=_r(d[44]),K=_r(d[45]),q=_r(d[46]),X=_r(d[47]),Z=_r(d[48]),ee=_r(d[49]),se=_r(d[50]),te=_r(d[51]),ae=_r(d[52]),ie=_r(d[53]),oe=_r(d[54]),re=_r(d[55]);_r(d[56]);var le=_r(d[57]),ne=_r(d[58]),de=_r(d[59]),ce=_r(d[60]),ue=_r(d[61]),he=_r(d[62]),fe=_r(d[63]),pe=_r(d[64]),ge=_r(d[65]),me=_r(d[66]),be=_r(d[67]),ye=_r(d[68]),xe=_r(d[69]),ke=_r(d[70]),je=_r(d[71]);const we=ge.ROSTER.find(e=>'chef'===e.app)?.id,ve=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'chat',label:'Chat',icon:'chat'},{id:'me',label:'Me',icon:'user'}],Ce=[{id:'home',label:'Home',icon:'home'},{id:'clock',label:'Clock',icon:'clock'},{id:'rota',label:'Rota',icon:'bookings'},{id:'cashup',label:'Cash up',icon:'cashup'},{id:'me',label:'Me',icon:'user'}],Se={home:'Today',clock:'Clock in / out',rota:'Rota, swaps & leave',chat:'Staff chat',me:'Me',cashup:'Cash up'},Te={id:'staffchat',title:'Staff chat',sub:'Messages with the team on this venue'},Me=[{id:'mytips',title:'Tips',sub:'The venue tip pot and today\u2019s tips'},{id:'reviews',title:'Reviews',sub:'Published reviews, newest first'},{id:'bookings',title:'Bookings',sub:'Any day, back or forward: tables, Covers, Unseat and Undo'},{id:'loyalty',title:'Stamp card',sub:'Find a guest, add a stamp or use a reward'},{id:'guests',title:'Guest profiles',sub:'Look a guest up: visits, Covers, allergies they told us, preferences'},{id:'giftcards',title:'Gift cards',sub:'Check a balance, take it off the bill, mark paid at the till'},{id:'tableorders',title:'Table orders',sub:'Orders from guests\u2019 phones at the table: accept, mark served or cancel'},{id:'soldout',title:'Sold out',sub:'What\u2019s run out today. Mark sold out or Back on; shows on the Display'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'recipecards',title:'Recipe cards',sub:'Signed-off dishes: photo, ingredients, method and allergens (read-only)'},{id:'avatar',title:'My avatar',sub:'Your space-age avatar, or create one from a photo'},{id:'cashup',title:'Cash up',sub:'End-of-night takings: type in the cash up, including paid outs, or upload a spreadsheet (if a manager has switched it on for you)'},{id:'haccp',title:'Food safety checks',sub:'Record fridge, freezer, cooking and other checks'},{id:'accidents',title:'Accident book',sub:'Report an accident or near miss; see your own entries'},{id:'mypay',title:'My hours & pay',sub:'Shifts, paid hours and estimated pay'},{id:'timesheets',title:'My timesheets',sub:'Your clock-ins, breaks and any changes'},{id:'orderlists',title:'Order lists',sub:'Add what\u2019s running low (Alsons drinks, Cash and carry)'},{id:'phone',title:'Turn on alerts',sub:'Get your reminders on this phone, even with the app closed'},{id:'suppliers',title:'Suppliers',sub:'Contacts and order days (if your manager allows)'},{id:'privacy',title:'Privacy & location',sub:'What CoverCharge for Staff stores about you'}],Re=[{id:'mgr-plan',title:'Tables & areas',sub:'Edit the table plan, areas, seats and joined tables'},{id:'mgr-times',title:'Booking times',sub:'Kitchen hours, table times and Covers per booking slot'},{id:'mgr-bookings',title:'Bookings (manager)',sub:'New, edit and cancel bookings, walk-ins, seat, move and finish tables, deposit status'},{id:'mgr-clear',title:'Tables to clear',sub:'Tables waiting to be cleared; mark them cleared'},{id:'mgr-blocks',title:'Block bookings',sub:'Block now, add a block, close the garden'},{id:'mgr-allergy',title:'Allergy checks',sub:'Every allergy order\u2019s sign-offs and the allergen log'},{id:'mgr-stock',title:'Tracked stock',sub:'What\u2019s counted live through service; add or change items'},{id:'mgr-clock',title:'Who\u2019s clocked in',sub:'Today\u2019s clock-ins for the team (read only)'},{id:'mgr-swaps',title:'Shift swaps',sub:'Approve swaps and cover, or give a shift to someone else'}];function Ae(){const{r:e,rid:r,me:n,meId:T,today:M,now:A}=(0,ee.useCtx)(3e4);(0,W.useReviewAlerts)(r),(0,he.useStaffTipsNotice)(r,M);const B=(0,ee.useSignedIn)(),fe=B?.ownerAccess&&'owner'!==B.role?'owner privileges':B?.managerAccess&&'staff'===B.role?'manager privileges':'',pe=(0,ee.useShiftManager)(),ge=(0,ke.useSync)(e=>e.perms),Ae=Re.filter(e=>'mgr-swaps'===e.id?ge.includes('rota.swap'):'mgr-times'!==e.id||(ge.includes('bookings.settings')||ge.includes('*')));(0,k.useSoldOutLink)(!0,n);(0,V.useOwner)(e=>e.staff);const Ie=(0,V.useOwner)(e=>e.staffCanViewSuppliers),[Oe,We]=(0,P.useState)('home'),[Le,ze]=(0,P.useState)(null),[Ee,He]=(0,P.useState)(!1),De=(0,P.useRef)(null);(0,P.useEffect)(()=>{(0,ee.ensureAttendance)(M,A),(0,G.ensureChat)(A)},[M]),globalThis.__ccNow=A.getTime();const Ne=(0,G.useChatUnread)().total,Fe=!0===(0,R.useCashAccess)(e=>e.mine),Ue=(0,P.useRef)({t:'home',s:null});Ue.current={t:Oe,s:Le};const Ve=(0,P.useRef)([]),$e=(0,P.useCallback)((e,s=null)=>{const t=Ue.current;t.t===e&&t.s===s||(Ve.current=[...Ve.current,{...t,y:Qe.leave()}].slice(-30),Qe.restore(0)),We(e),ze(s)},[]),Ge=(0,P.useCallback)(()=>{if((0,f.runBackLayer)())return!0;const e=Ue.current;let s=Ve.current.pop();for(;s&&s.t===e.t&&s.s===e.s;)s=Ve.current.pop();if(!s&&'home'===e.t&&!e.s)return!1;const t=s??{t:'home',s:null};return Qe.leave(),We(t.t),ze(t.s),Qe.restore(t.y??0),!0},[]);(0,f.useWebBack)(Ge);const Ye=(0,f.useInnerBackShown)();(0,P.useEffect)(()=>{C.PITCH&&(globalThis.__pitchGo=$e,globalThis.__pitchClock={setClockServer:v.setClockServer,markClockSent:v.markClockSent,markClockUnsent:v.markClockUnsent})},[$e]),(0,P.useEffect)(()=>(0,w.startForegroundRefresh)(),[]),(0,Q.useShiftReminders)({rid:r,staffId:T,name:n,onStartBreak:()=>$e('clock')}),(0,J.useScheduledNotices)({rid:r,staffId:B?.id??'',name:n,onOpen:e=>{'orderlists'===e&&$e('me','orderlists'),'chat'===e&&(Fe?$e('me','staffchat'):$e('chat'))}}),(0,K.useOffRotaPrompt)({rid:r,staffId:B?.id??''});const Qe=(0,h.useScrollMemory)(De),Je=(0,P.useCallback)((e,s=null)=>'chat'===e||'staffchat'===s||'chat'===s?Fe?$e('me','staffchat'):$e('chat'):'cashup'===e?$e('cashup'):'clock'===s?$e('clock'):'rota'===s?$e('rota'):s&&Me.some(e=>e.id===s)?$e('me',s):'blocks'===s&&pe?$e('me','mgr-blocks'):void $e('home'===e?'home':'me'),[$e,pe,Fe]);(0,P.useEffect)(()=>{const e=z.default.addEventListener('hardwareBackPress',Ge);return()=>e.remove()},[Ge]);const Ke=Fe?[Te,...Me]:Me,qe='me'===Oe&&Le?Ke.find(e=>e.id===Le)??(pe?Ae.find(e=>e.id===Le):void 0):void 0,Xe=(0,Z.useOrderLists)(e=>e.settings[r]?.allowStaff??!0),Ze=Ke.filter(e=>('suppliers'!==e.id||Ie)&&('orderlists'!==e.id||Xe||B&&'staff'!==B.role)),es=Fe?Ce:ve,ss='cashup'===Oe||'cashup'===qe?.id?'cashup':Oe;(0,P.useEffect)(()=>{V.useOwner.getState().staffAs&&V.useOwner.setState({staffAs:void 0})},[]),(0,P.useEffect)(()=>{Fe&&'chat'===Oe&&$e('me','staffchat')},[Fe,Oe,$e]);(0,D.default)().width;return(0,je.jsxs)(N.SafeAreaView,{style:{flex:1,backgroundColor:$.colours.bg},edges:['top','left','right','bottom'],children:[(0,je.jsxs)(_.default,{style:{position:'relative',paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:$.colours.border,gap:6},children:[(0,je.jsx)(_.default,{testID:"header-me-wrap",style:{alignItems:'flex-start',minHeight:44,justifyContent:'center',maxWidth:'100%'},children:(0,je.jsx)(E.default,{testID:"header-me",accessibilityRole:"button",accessibilityLabel:`${(0,o.privateClockVenue)(r)?`Signed in as ${n}`:'Signed in as'}${fe?`, ${fe}`:''}`,onPress:()=>He(!0),hitSlop:6,style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:22,paddingHorizontal:10,paddingVertical:4,maxWidth:'100%',minHeight:44,justifyContent:'center'},children:(0,je.jsxs)(F.Row,{gap:6,style:{justifyContent:'flex-start'},children:[(0,je.jsx)(ye.StaffAvatar,{id:T,size:24,ring:!1}),(0,je.jsxs)(_.default,{style:{flexShrink:1},children:[(0,je.jsxs)(F.T,{size:13,weight:"semibold",colour:$.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[n.replace(' (example)',''),B?'':' (preview)'," \u25be"]}),fe?(0,je.jsx)(F.Muted,{center:!1,size:10,numberOfLines:1,children:fe}):null]})]})})}),(0,je.jsx)(U.VenueHeaderBlock,{rid:e.id,name:e.name,badge:"STAFF",place:"Front of House"+(e.location?` \xb7 ${e.location.split(',').slice(0,2).join(',')}`:'')})]}),(0,je.jsxs)(H.default,{ref:De,...Qe.props,contentContainerStyle:{padding:14,paddingBottom:16,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:['home'===Oe?(0,je.jsx)(u.AlertsBanner,{}):null,'home'===Oe?(0,je.jsx)(c.WhosOnShift,{}):null,(0,je.jsx)(f.BackTitleRow,{back:!('home'===Oe&&!Le||Ye),onBack:Ge,title:qe?qe.title:Se[Oe]}),'home'===Oe&&pe?(0,je.jsx)(ie.ManagerFeaturesNote,{}):null,'home'===Oe&&B&&'staff'!==B.role&&!pe&&'undefined'!=typeof window?(0,je.jsxs)(_.default,{testID:"manager-access-banner",style:{borderWidth:1,borderColor:$.colours.gold,borderRadius:12,padding:10,gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"You have manager access"}),(0,je.jsx)(F.Muted,{children:"The Manager app has everything here plus bookings, the rota, staff and settings."}),(0,je.jsx)(E.default,{accessibilityRole:"button",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)},style:{alignSelf:'flex-start',borderWidth:1,borderColor:$.colours.gold,borderRadius:14,paddingHorizontal:12,paddingVertical:5,minHeight:44,justifyContent:'center'},children:(0,je.jsx)(F.T,{size:14,colour:$.colours.gold,children:"Open the Managers app \u203a"})})]}):null,'home'===Oe&&B?(0,je.jsx)(S.MyTasksToday,{rid:r,staffId:B.id,name:B.name,onShift:(0,Q.shiftNow)(B.id,A.getTime()).on}):null,'home'===Oe?(0,je.jsx)(Be,{go:Je}):null,'clock'===Oe?(0,je.jsx)(ue.ClockInOut,{}):null,'rota'===Oe?(0,je.jsx)(ue.Rota,{}):null,'chat'===Oe||'staffchat'===qe?.id?(0,je.jsx)(G.Chat,{go:Je}):null,'cashup'===Oe?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'me'!==Oe||qe?null:(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.border,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ze.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),pe?(0,je.jsxs)(_.default,{testID:"manager-features",style:{gap:6},children:[(0,je.jsx)(F.T,{weight:"semibold",colour:$.colours.gold,children:"Manager features"}),(0,je.jsx)(_.default,{style:{borderRadius:14,borderWidth:1,borderColor:$.colours.gold,backgroundColor:$.colours.surface,overflow:'hidden'},children:Ae.map((e,s)=>(0,je.jsx)(E.default,{testID:`audit-page-${e.id}`,accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>$e('me',e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:$.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,je.jsxs)(F.Row,{style:{justifyContent:'space-between'},children:[(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"medium",children:e.title}),(0,je.jsx)(F.Muted,{children:e.sub})]}),(0,je.jsx)(F.T,{colour:$.colours.muted,children:"\u203a"})]})},e.id))}),(0,je.jsx)(ie.ManagerFeaturesAbout,{})]}):null,Ie?null:(0,je.jsx)(F.Muted,{children:"Suppliers are hidden: your manager hasn\u2019t shared them with staff."}),(0,je.jsxs)(F.Muted,{center:!0,children:["Staff app \xb7 ",j.APP_VERSION," \xb7 ",'live'===ke.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),pe&&qe?.id.startsWith('mgr-')?(0,je.jsxs)(ee.ShiftMgrScope.Provider,{value:!0,children:['mgr-plan'===qe.id?(0,je.jsx)(s.TablePlan,{}):null,'mgr-times'===qe.id?(0,je.jsx)(t.StaffBookingTimes,{}):null,'mgr-bookings'===qe.id?(0,je.jsx)(Y.Bookings,{}):null,'mgr-clear'===qe.id?(0,je.jsx)(ie.TablesToClear,{rid:r}):null,'mgr-blocks'===qe.id?(0,je.jsx)(se.BlocksPage,{}):null,'mgr-allergy'===qe.id?(0,je.jsx)(te.AllergenSignOffLog,{}):null,'mgr-stock'===qe.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(ae.TrackedStockPage,{}),(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)','')})]}):null,'mgr-clock'===qe.id?(0,je.jsx)(ie.ClockOverview,{today:M,now:A}):null,'mgr-swaps'===qe.id?(0,je.jsx)(ie.SwapApprovals,{today:M,me:n}):null]}):null,'loyalty'===qe?.id?(0,je.jsx)(p.StaffLoyalty,{venue:e.name,canWrite:pe}):null,'guests'===qe?.id?(0,je.jsx)(b.GuestProfiles,{me:n.replace(' (example)',''),manager:!1}):null,'bookings'===qe?.id?(0,je.jsx)(Y.Bookings,{}):null,'giftcards'===qe?.id?(0,je.jsx)(y.GiftCardsPage,{me:n.replace(' (example)',''),canWrite:pe}):null,'tableorders'===qe?.id?(0,je.jsx)(l.StaffTableOrders,{rid:r,me:n.replace(' (example)',''),canWrite:pe}):null,'soldout'===qe?.id?(0,je.jsx)(x.SoldOutList,{rid:r,by:n.replace(' (example)',''),canMark:pe}):null,'board'===qe?.id?(0,je.jsx)(L.QuestionBoard,{rid:r,today:M,manager:!1,by:""}):null,'recipecards'===qe?.id?(0,je.jsx)(I.RecipeCards,{rid:e.id,actor:{name:n,role:'staff'},mode:"read"}):null,'avatar'===qe?.id?(0,je.jsx)(xe.AvatarMaker,{meId:T,me:n}):null,'cashup'===qe?.id?(0,je.jsx)(Pe,{rid:r,today:M,meId:T,me:n}):null,'haccp'===qe?.id?(0,je.jsx)(be.HaccpLog,{mode:"staff",me:n,meId:T,now:A,rid:e.id}):null,'accidents'===qe?.id?(0,je.jsx)(me.AccidentBook,{app:"staff",me:n,meId:T,now:A,seeAll:!1}):null,'mypay'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ne.MyHoursPay,{staffId:T})]}):null,'mytips'===qe?.id?(0,je.jsx)(he.MyTips,{}):null,'reviews'===qe?.id?(0,je.jsx)(O.ReviewsSection,{rid:r,mode:"read",venueName:e.name}):null,'timesheets'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(de.MyPeriods,{staffId:T}),(0,je.jsx)(ue.Timesheets,{})]}):null,'orderlists'===qe?.id?(0,je.jsx)(q.OrderListsScreen,{rid:r,today:M,editor:!!B&&'staff'!==B.role&&!pe,who:{id:T,name:n.replace(' (example)','')}}):null,'phone'===qe?.id?(0,je.jsx)(X.PhoneAlerts,{}):null,'suppliers'===qe?.id?Ie?(0,je.jsx)(ce.Suppliers,{}):(0,je.jsx)(F.Muted,{children:"Your manager hasn\u2019t shared suppliers with staff."}):null,'privacy'===qe?.id?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,o.privateClockVenue)(r)?(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(F.T,{size:14,children:"Location is checked only when you choose Clock in at the pub. Only a pass or fail is saved with the clock-in time, or an audited manager override."}),(0,je.jsx)(F.T,{size:14,children:"Your position, accuracy and distance are never saved. There are no location trails, background/arrival checks, clock-out checks or break checks."})]}):(0,je.jsxs)(je.Fragment,{children:[" ",(0,je.jsx)(F.T,{size:14,children:"\u2022 Location is checked when you tap Clock in, Clock out, Start break or End break, and (if you allowed location) while the app is open to ask if you want to clock in when you\u2019re at the venue but not on the rota. Never in the background."}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Each clock record keeps the location reading, how accurate it was, whether it was inside the venue area, and the time. Managers can see these."})]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 You see only your own hours, pay estimates and tips. Managers see the team\u2019s."}),(0,je.jsxs)(F.T,{size:14,children:["\u2022 Chat messages stay within ",e.name,"\u2019s team."]}),(0,je.jsx)(F.T,{size:14,children:"\u2022 Pay figures are estimates before tax and deductions; your payslip is the official record."})]}):null]}),(0,je.jsx)(le.BottomTabs,{background:(0,i.soutersSurface)('#0d0d0d'),active:ss,onPress:e=>$e(e),tabs:es.map(e=>({id:e.id,label:e.label,icon:e.icon,badge:'chat'===e.id&&Ne||'me'===e.id&&Fe&&Ne?{text:String(Ne),bg:$.colours.red}:null}))}),(0,je.jsx)(F.Sheet,{visible:Ee,onClose:()=>He(!1),title:"Signed in as",children:B?(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsxs)(F.Row,{gap:10,children:[(0,je.jsx)(ye.StaffAvatar,{id:B.id,size:48}),(0,je.jsxs)(_.default,{style:{flex:1},children:[(0,je.jsx)(F.T,{weight:"semibold",children:B.name}),(0,je.jsx)(F.Muted,{children:(0,re.levelJob)(B.level??'Staff',B.job)})]})]}),(0,je.jsx)(F.Muted,{children:"Signed in with your personal link. This phone remembers you."}),pe?(0,je.jsx)(F.Muted,{children:"Manager features are on for you in this app."}):null,'staff'===B.role||pe?null:(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Managers",onPress:()=>{const e=(0,re.appUrl)('owner');e&&window.location.assign(e)}}),B.id===we?(0,je.jsx)(F.Button,{kind:"secondary",label:"Back to CoverCharge for Head Chef",onPress:()=>{const e=(0,re.appUrl)('chef');e&&window.location.assign(e)}}):null]}):(0,je.jsxs)(_.default,{style:{gap:8},children:[(0,je.jsx)(F.Muted,{children:"Not signed in: this is a preview. Open your personal link, or paste it here, to sign in as yourself."}),(0,je.jsx)(oe.SignInWithLink,{})]})})]})}function Be({go:e}){const{rid:s,today:t}=(0,ee.useCtx)(3e4),i=(0,pe.useTravelDay)('staff',t);return(0,je.jsxs)(_.default,{style:{gap:10},children:[(0,je.jsx)(n.WhoBar,{}),(0,je.jsx)(pe.DayBar,{app:"staff",today:t}),i?null:(0,je.jsx)(r.CoversToday,{rid:s}),i?(0,je.jsx)(pe.DayView,{rid:s,day:i,today:t,app:"staff"}):(0,je.jsx)(fe.StaffHome,{go:e})]})}function Pe({rid:e,today:s,meId:t,me:i}){const o=(0,R.useCashAccess)(e=>e.mine),r=(0,R.useCashAccess)(e=>e.takings),l=(0,R.useCashAccess)(e=>e.tradingDate),n=(0,ke.useSync)(e=>e.perms),c=!1===r||null==r&&!n.includes('*')&&!n.includes('takings.view'),u=l??(0,B.tradingDay)();return(0,P.useEffect)(()=>{c&&(0,A.forgetPastTakings)(e,u)},[c,e,u]),!0!==o?(0,je.jsx)(M.NoCashUpAccess,{}):(0,je.jsx)(T.CashUpScreen,{rid:e,today:c?u:s,canEdit:!0,closer:c,who:{id:t??'me',name:i.replace(' (example)','')}})}},1414,[1415,1419,813,912,1072,1420,1203,1204,1028,1025,1026,1421,1423,1426,1153,891,978,1428,975,880,1031,1032,1429,914,1008,915,17,1155,1231,1235,1197,356,385,278,85,409,19,777,857,876,804,1161,1430,1066,1084,1086,1081,1027,1010,1057,1437,1438,1439,1447,1448,920,219,1236,1176,1182,1444,1196,1193,1453,1179,878,1206,1207,884,776,899,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.TablePlan=function({startStep:e}){const{rid:s,r:n,now:w,me:f,role:S}=(0,b.useCtx)(6e4),T=(0,x.usePlan)(s),[P,C]=(0,t.useState)(null),[D,I]=(0,t.useState)(T.areas[0]?.id??''),[M,B]=(0,t.useState)(null),N=T.areas.find(e=>e.id===D)??T.areas[0],O=(0,x.planCounts)(T),A=(0,p.closedAreasAt)((0,p.useBlocks)(e=>e.blocks),s,(0,y.ymd)(w),`${String(w.getHours()).padStart(2,'0')}:${String(w.getMinutes()).padStart(2,'0')}`);return(0,k.jsxs)(a.default,{style:{gap:12},testID:"tableplan-page",children:[(0,k.jsxs)(h.Muted,{children:["The table plan for ",n.name,". Each venue has its own plan; it drives the Display floor view, walk-ins and which tables online bookings can use."]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{children:[(0,k.jsxs)(h.T,{size:20,weight:"bold",colour:j.colours.gold,children:[O.tables," tables \xb7 ",O.seats," seats"]}),(0,k.jsxs)(h.Muted,{children:[T.areas.length," areas \xb7 ",T.joins.length," joined ",1===T.joins.length?"pair":"pairs"]})]}),(0,k.jsx)(h.Button,{label:"Open table plan designer",testID:"open-designer",onPress:()=>C(e??'arrange')})]}),v.RELEASE.planPhoto?(0,k.jsx)(m.PlanPhoto,{rid:s}):null,(0,k.jsx)(a.default,{style:{gap:6},children:T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return(0,k.jsxs)(a.default,{testID:`area-summary-${e.id}`,style:{width:'100%',minWidth:0,gap:8,alignItems:'stretch',borderTopWidth:1,borderTopColor:j.colours.border,paddingTop:12,paddingBottom:6},children:[(0,k.jsx)(h.T,{center:!0,weight:"semibold",colour:(0,j.brandColour)(e.colour),children:e.name}),e.dogs||e.outdoor?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,style:{justifyContent:'center'},children:[e.dogs?(0,k.jsx)(h.Badge,{kind:"gold",label:"\ud83d\udc3e Dogs allowed"}):null,e.outdoor?(0,k.jsx)(h.Badge,{kind:A.has(e.id)?'red':'neutral',label:A.has(e.id)?'\ud83c\udf27 Closed for weather':'\ud83c\udf26 Outdoor'}):null]}):null,e.label?(0,k.jsx)(h.Muted,{center:!0,size:14,children:e.label}):null,(0,k.jsxs)(h.Muted,{center:!0,children:[s.tables," tables \xb7 ",s.seats," seats"]})]},e.id)})}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Areas",onPress:()=>C('areas')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Tables",onPress:()=>C('tables')}),(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:"Arrange",onPress:()=>C('arrange')})]})]}),T.areas.some(e=>e.outdoor)?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Weather"}),(0,k.jsx)(h.Muted,{children:"Closes the outdoor areas for the rest of today: no online bookings or walk-ins there, and the Display shows them as closed. Uses Block bookings, so you can reopen in one tap."}),(0,k.jsx)(c.CloseGardenButton,{rid:s,r:n,now:w,by:f})]}):null,N?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(o.AreaTabs,{plan:T,area:N.id,onPick:I,closed:A,counts:Object.fromEntries(T.areas.map(e=>{const s=(0,x.planCounts)(T,e.id);return[e.id,`${s.tables} \xb7 ${s.seats}`]}))}),(0,k.jsx)(a.default,{pointerEvents:"none",style:{borderRadius:12,overflow:'hidden'},children:(0,k.jsx)(r.FloorCanvas,{plan:T,areaId:N.id,mode:"live",fit:"width",maxH:360,sectionColours:!0})}),(0,k.jsx)(h.Muted,{children:"Preview only. Open the designer to change it."})]}):null,M?(0,k.jsx)(h.Banner,{kind:"success",title:M}):null,(0,k.jsx)(l.default,{visible:!!P,animationType:"slide",onRequestClose:()=>C(null),presentationStyle:"fullScreen",children:(0,k.jsx)(a.default,{style:{flex:1,backgroundColor:j.colours.bg},children:P?(0,k.jsx)(u.PlanDesigner,{initial:T,venue:n.name,mode:"managers",role:S,startStep:P,onSave:e=>{x.useFloor.getState().setPlan(s,e),C(null),B('Table plan saved. The Display uses it straight away.')},onLiveChange:e=>{x.useFloor.getState().setPlan(s,e),B('Live seating plan updated on every screen.')},onCancel:()=>C(null)}):null})})]})},_e.DisplaySettingsPage=function(){const{rid:e,role:s}=(0,b.useCtx)(6e4),t=(0,x.useDisplaySettings)(e),n=s=>x.useFloor.getState().setSettings(e,s);return(0,k.jsxs)(a.default,{style:{gap:14},children:[(0,k.jsxs)(a.default,{style:{gap:6},testID:"privacy-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Privacy on the Display"}),'owner'===s?(0,k.jsx)(h.Toggle,{label:"Privacy mode (recommended)",value:t.privacy,onChange:e=>n({privacy:e})}):(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:"Privacy mode"}),(0,k.jsxs)(h.T,{weight:"semibold",children:[t.privacy?'On':'Off'," \xb7 owner only"]})]}),(0,k.jsx)(h.Muted,{children:"On: guest surnames show as initials (Campbell \u2192 C.), and no phone numbers, emails, notes or allergy details appear on the main screen (an icon only). Staff tap for details in a panel that closes after 20 seconds."})]}),(0,k.jsxs)(a.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Screensaver"}),(0,k.jsx)(h.T,{size:14,children:"Start after nobody touches the Display for"}),(0,k.jsx)(h.Row,{gap:6,children:[1,2,5,10].map(e=>(0,k.jsx)(a.default,{testID:`idle-${e}`,children:(0,k.jsx)(h.Chip,{label:`${e} min`,selected:t.idleMins===e,onPress:()=>n({idleMins:e})})},e))}),(0,k.jsx)(h.Toggle,{label:"Ask for a staff PIN on wake",value:t.pinOn,onChange:e=>n({pinOn:e})}),t.pinOn?(0,k.jsx)(S,{rid:e}):null,(0,k.jsx)(h.Muted,{children:"Used on this Display until a screensaver is saved in Settings \u203a Display screensaver (style, idle time and night dim for every Display, changed live). Any touch wakes it straight away and that first touch doesn\u2019t press anything. Where the browser allows, the Display also asks to keep the screen on."})]}),(0,k.jsx)(T,{}),(0,k.jsxs)(a.default,{style:{gap:6},testID:"wipe-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Shared tablet or phone"}),(0,k.jsx)(h.Muted,{children:"Selling or handing over this device, or it was used by someone who has left? Sign out and wipe it."}),(0,k.jsx)(f.WipeDevice,{})]}),(0,k.jsx)(h.Banner,{kind:"info",title:"Settings live on this device",children:"They\u2019re saved in this browser for the venue and picked up by the Display app on the same device."})]})};var s=_r(d[0]),t=_r(d[1]),n=_r(d[2]),l=e(_r(d[3])),a=e(_r(d[4])),o=_r(d[5]),r=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]),b=_r(d[14]),w=_r(d[15]),f=_r(d[16]),m=_r(d[17]),v=_r(d[18]),k=_r(d[19]);function S({rid:e}){const n=(0,x.useDisplaySettings)(e),[l,o]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[c,p]=(0,t.useState)(null),y=l?(0,w.wakePinProblem)(l):null,b=[h.styles.input,{width:130}];return(0,k.jsxs)(a.default,{style:{gap:6},testID:"wake-pin-setting",children:[n.pinDefault?(0,k.jsx)(a.default,{testID:"wake-pin-default",children:(0,k.jsx)(h.Banner,{kind:"warn",title:"Change the wake PIN",children:"This Display still uses the starting PIN, 2580, which anyone could guess. Set a new 6 to 8 digit PIN below."})}):(0,k.jsxs)(h.Muted,{children:["A wake PIN of ",n.pinLen," digits is set. Type a new one to change it."]}),(0,k.jsxs)(h.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(s.TextInput,{testID:"wake-pin-new",accessibilityLabel:"New wake PIN",value:l,onChangeText:e=>{o(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"New PIN (6\u20138 digits)",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(s.TextInput,{testID:"wake-pin-again",accessibilityLabel:"New wake PIN again",value:r,onChangeText:e=>{u(e.replace(/\D/g,'').slice(0,8)),p(null)},placeholder:"Type it again",placeholderTextColor:j.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",style:b}),(0,k.jsx)(h.Button,{small:!0,testID:"wake-pin-save",label:"Save PIN",disabled:!l||!r,onPress:()=>{const s=(0,w.wakePinProblem)(l);s?p(s):l===r?(x.useFloor.getState().setSettings(e,(0,w.makeWakePin)(l)),o(''),u(''),p('Wake PIN saved. Tell the team in person; it isn\u2019t shown again.')):p('The two PINs don\u2019t match.')}})]}),c||y?(0,k.jsx)(h.Muted,{children:c??y}):null]})}function T(){const[e,s]=(0,t.useState)((0,n.flapSoundOn)());return(0,k.jsxs)(a.default,{style:{gap:6},testID:"flap-sound-setting",children:[(0,k.jsx)(h.T,{weight:"semibold",colour:j.colours.gold,children:"Covers counter sound"}),(0,k.jsx)(h.Toggle,{label:"Soft flap click when the Covers change (Display only)",value:e,onChange:e=>{(0,n.setFlapSound)(e),s(e)}}),(0,k.jsx)(h.Muted,{children:"Off by default. Only this device clicks; phones never do."})]})}},1415,[812,17,1018,378,85,1108,1109,1361,1394,777,995,998,863,804,1057,999,1416,1417,1020,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1416,[812,17,385,85,777,804,998,805,999,856,899,8]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.PlanPhoto=function({rid:e}){const t=(0,n.usePlan)(e),b=(0,n.useFloor)(e=>e.setPlan),[y,f]=(0,a.useState)(null),[x,w]=(0,a.useState)(null),[v,j]=(0,a.useState)(null),[k,S]=(0,a.useState)(''),[P,T]=(0,a.useState)(!1),I=async e=>{let a;T(!0);try{const{data:t,error:l}=await(0,u.getSupabase)().functions.invoke('plan-photo-read',{body:{image:e}});a=l?{ok:!1,message:'The plan could not be read. The photo is still here.'}:{ok:!0,tables:(0,o.cleanFindings)(t)}}catch{a={ok:!1,message:'The plan could not be read. The photo is still here.'}}finally{T(!1)}const t=(0,o.planReadAfter)(e,a);w(t.photo),f(t.rows&&t.rows.length?t.rows:null),S(t.note)},L=async()=>{S('');const e=(await(0,c.pickPhotos)({source:'camera'}))[0];e?(w(e),await I(e)):S('No photo taken.')};return(0,p.jsxs)(l.default,{testID:"plan-photo",style:{width:'100%',alignItems:'center',gap:10},children:[(0,p.jsx)(s.Button,{testID:"plan-photo-camera",label:P?'Reading the plan\u2026':'Take a picture of the table plan',accessibilityLabel:"Take a picture of a hand-drawn table plan",disabled:P,onPress:()=>{L()}}),k?(0,p.jsx)(s.Muted,{center:!0,testID:"plan-photo-note",children:k}):null,x&&!P?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-retry",label:"Read this photo again",accessibilityLabel:"Read this photo again",onPress:()=>{I(x)}}):null,y?(0,p.jsx)(l.default,{testID:"plan-photo-review",style:{width:'100%'},children:(0,p.jsxs)(s.Card,{style:{alignItems:'center',width:'100%'},children:[(0,p.jsx)(s.T,{center:!0,weight:"bold",colour:h.colours.gold,children:"Check what was read"}),(0,p.jsx)(s.Muted,{center:!0,children:"Nothing is saved until you tap Save the plan."}),y.map((e,a)=>(0,p.jsxs)(l.default,{style:{width:'100%',gap:6},children:[(0,p.jsx)(s.Field,{label:"Area",accessibilityLabel:`Area ${a+1}`,value:e.area,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,area:e}:t))}),(0,p.jsx)(s.Field,{label:"Table",accessibilityLabel:`Table ${a+1}`,value:e.name,onChangeText:e=>f(y.map((t,l)=>l===a?{...t,name:e}:t))}),(0,p.jsx)(s.Field,{label:"Seats",accessibilityLabel:`Seats at table ${a+1}`,value:String(e.seats),keyboardType:"number-pad",onChangeText:e=>f(y.map((t,l)=>l===a?{...t,seats:Math.max(1,Math.min(30,Number(e.replace(/\D/g,''))||1))}:t))}),(0,p.jsx)(s.Button,{kind:"ghost",label:`Remove ${e.name||'table'}`,accessibilityLabel:`Remove ${e.name||'table'}`,onPress:()=>f(y.filter((e,t)=>t!==a))})]},`${e.area}-${e.name}-${a}`)),(0,p.jsx)(s.Button,{testID:"plan-photo-save",label:"Save the plan",accessibilityLabel:"Save the checked table plan",disabled:!y.length,onPress:()=>{if(!y?.length)return;j(t);const a=[...t.areas],l=[...t.tables];for(const e of y){let t=a.find(a=>a.name.toLowerCase()===e.area.toLowerCase());t||(t={id:(0,i.fid)('area'),name:e.area},a.push(t));const s=(0,i.sizeFor)(e.seats),n=l.filter(e=>e.areaId===t.id).length;l.push({id:(0,i.fid)('t'),name:e.name,areaId:t.id,shape:s.shape,minSeats:1,maxSeats:e.seats,x:40+n%6*140,y:40+120*Math.floor(n/6),w:s.w,h:s.h,rot:0,online:!0})}b(e,{...t,areas:a,tables:l}),f(null),S('Plan saved. Undo puts the previous plan back.')}})]})}):null,v?(0,p.jsx)(s.Button,{kind:"ghost",testID:"plan-photo-undo",label:"Undo table plan",accessibilityLabel:"Undo the table plan and restore the previous one",onPress:()=>{b(e,v),j(null),S('Previous plan restored.')}}):null]})};var e,a=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=r(d[2]),n=r(d[3]),o=r(d[4]),i=r(d[5]),h=r(d[6]),c=r(d[7]),u=r(d[8]),p=r(d[9])},1417,[17,85,777,998,1418,842,804,1038,928,8]); +__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):''},1418,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffBookingTimes=function(){const{r:e,rid:s}=(0,o.useCtx)(),[u,c]=(0,t.useState)(()=>Object.fromEntries(d.map(([t])=>[t,e.kitchenHours?.[t]??null]))),[h,b]=(0,t.useState)(String(e.settings.turnMins??'')),[v,y]=(0,t.useState)(String(e.settings.bookingCoversPerSlot??'')),[x,j]=(0,t.useState)(''),[k,S]=(0,t.useState)(!1),f=(e,t,s)=>c(n=>({...n,[e]:0===t?[s,n[e]?.[1]??'']:[n[e]?.[0]??'',s]})),p=Object.values(u).every(e=>!e||e.every(e=>/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e))&&e[0]=30&&Number(h)<=360&&Number(v)>=1&&Number(v)<=1e3;return(0,r.jsxs)(n.default,{style:{gap:12,width:'100%',minWidth:0},testID:"staff-booking-times",children:[(0,r.jsx)(i.T,{center:!0,weight:"bold",children:"Booking times"}),(0,r.jsx)(i.Muted,{center:!0,children:"Change kitchen hours, table time and the Covers offered in each booking slot. Table layout and blocks have their own screens."}),d.map(([e,t])=>(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.T,{center:!0,weight:"semibold",children:t}),(0,r.jsx)(i.Toggle,{label:`${t} open`,value:!!u[e],onChange:t=>c(s=>({...s,[e]:t?['','']:null}))}),u[e]?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.Field,{label:`${t} opens (HH:MM)`,value:u[e][0],placeholder:"HH:MM",onChangeText:t=>f(e,0,t)}),(0,r.jsx)(i.Field,{label:`${t} closes (HH:MM)`,value:u[e][1],placeholder:"HH:MM",onChangeText:t=>f(e,1,t)})]}):(0,r.jsx)(i.Muted,{center:!0,children:"Closed"})]},e)),(0,r.jsxs)(i.Card,{children:[(0,r.jsx)(i.Field,{label:"Typical table time, minutes",value:h,onChangeText:b,keyboardType:"number-pad"}),(0,r.jsx)(i.Field,{label:"Covers per 30-minute booking slot",value:v,onChangeText:y,keyboardType:"number-pad"}),e.settings.bookingCoversPerStart||e.settings.bookingPartiesPerStart?(0,r.jsx)(i.Muted,{center:!0,children:"Online booking uses the covers and bookings caps at each start time (Settings \u203a Capacity & waitlist), not this half-hour figure."}):null]}),(0,r.jsx)(i.Button,{label:k?'Saving\u2026':'Save booking times',disabled:!p||k,accessibilityLabel:"Save booking times without changing other venue settings",onPress:async()=>{S(!0);try{await(0,l.saveStaffBookingTimes)(s,u,Number(h),Number(v)),j('Booking times saved.')}catch(e){j(e.message)}finally{S(!1)}}}),x?(0,r.jsx)(i.Muted,{center:!0,children:x}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=(e=s)&&e.__esModule?e:{default:e},i=_r(_d[2]),o=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]);const d=[[1,'Monday'],[2,'Tuesday'],[3,'Wednesday'],[4,'Thursday'],[5,'Friday'],[6,'Saturday'],[0,'Sunday']]},1419,[17,85,777,1057,899,8]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l,canWrite:p=!0}){const x=(0,c.useOrderAtTable)(e),f=(0,c.useNow)(15e3),w=(0,c.useStore)(e=>e.bookings),S=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),y=S.filter(i.waitingForStaff),v=S.filter(e=>j(e)&&!(0,i.waitingForStaff)(e)),k=S.filter(e=>!j(e)).slice(0,8),[T,$]=(0,s.useState)(null),[M,B]=(0,s.useState)(null),N=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for table ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},O=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,w));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},A=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),$(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},R=({o:e,held:s})=>(0,b.jsxs)(a.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{weight:"semibold",children:["Table ",(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(a.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(a.Muted,{children:[e.customerName," \xb7 ",m(e.createdAt,f),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(a.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(a.Badge,{kind:"red",label:`${(0,n.allergenLabel)(e.allergen)}: ${(0,n.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(a.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(a.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(a.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or with the server"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(a.Muted,{children:["Reason: ",e.cancelReason]}):null,j(e)&&p?T===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(a.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(a.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(a.Chip,{label:t,onPress:()=>A(e,t)},t))}),(0,b.jsx)(a.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>$(null)})]}):(0,b.jsxs)(a.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(a.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>N(e)}):(0,b.jsx)(a.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>O(e)}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>$(e.id)})]}):j(e)&&!p?(0,b.jsx)(a.Muted,{children:"Ask a manager to accept, mark served or cancel this order."}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(a.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or with their server."}),x?null:(0,b.jsx)(a.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),M?(0,b.jsx)(a.Banner,{kind:"success",children:M}):null,(0,b.jsxs)(a.T,{weight:"semibold",children:["Waiting for you to accept (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(R,{o:e,held:!0},e.id)):(0,b.jsx)(a.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(a.T,{weight:"semibold",children:["In the kitchen (",v.length,")"]}),v.length?v.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id)):(0,b.jsx)(a.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(R,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},a=_r(d[3]),n=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const m=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},j=e=>!['served','collected','closed','cancelled'].includes(e.status)},1420,[843,17,85,777,845,851,1154,858,853,804,8]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,canWrite:u=!0,onOpenSettings:p}){const[x,y]=(0,t.useState)(null),[b,S]=(0,t.useState)(''),[k,v]=(0,t.useState)(null),[C,M]=(0,t.useState)(null),[T,B]=(0,t.useState)(!1),[R,P]=(0,t.useState)(''),[O,$]=(0,t.useState)(null),L=(0,c.staffServer)(),N=(0,n.can)('venue.settings'),[E,A]=(0,t.useState)(!1),[D,F]=(0,t.useState)(''),I=async e=>{if(x){A(!0),F('');try{await(0,c.saveSettings)({...x,cardOn:e}),y({...x,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';F(n),s.default.announceForAccessibility?.(n)}catch(e){P((0,o.plainError)(e))}A(!1)}},_=(0,t.useCallback)(()=>{L&&(0,c.readSettings)().then(y).catch(()=>{})},[L]);(0,t.useEffect)(()=>(_(),(0,c.watchLoyalty)(()=>{_(),M(e=>(e&&(0,c.staffCard)(e.id).then(M).catch(()=>{}),e))})),[_]);const z=async(e=b)=>{P('');try{const n=await(0,c.staffFind)(e);v(n),1===n.length&&M(n[0])}catch(e){P((0,o.plainError)(e))}},H=(0,t.useCallback)(e=>{B(!1),S((0,o.prettyCardNo)(e)),z(e)},[]);return L?(0,m.jsxs)(l.default,{style:{gap:10},children:[!x||x.cardOn||N?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),x&&N?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[x.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(x.cardOn?'On':'Off'),value:x.cardOn,disabled:E,onChange:e=>{I(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,p?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:p}):null]})}):null,x&&x.saved?(0,m.jsxs)(i.Muted,{children:[x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,x&&!x.saved&&N?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",x.stampsNeeded," stamps = ",x.reward||'reward not set',". At most ",x.maxPerDay," a day",x.gapMinutes?`, ${x.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:b,onChangeText:S,onSubmitEditing:()=>z(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:b.trim().length<2,onPress:()=>z(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:T?'Scanning\u2026':'Scan their card',onPress:()=>B(!0)}):null]}),T?(0,m.jsx)(h.CardScanner,{onCard:H,onClose:()=>B(!1)}):null,R?(0,m.jsx)(i.Banner,{kind:"warn",children:R}):null,k&&!k.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,k&&k.length>1?k.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>M(e)})]},e.id)):null]}),C?(0,m.jsx)(f,{card:C,settings:x,canRemove:r,canWrite:u,onChange:e=>{M(e),v(null)},onClose:()=>M(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),u&&O?(0,m.jsx)(j,{c:O,what:"One stamp."}):null,u?(0,m.jsx)(i.Button,{kind:"secondary",label:O?'Make another code':'Make a stamp code',disabled:!1===x?.cardOn,onPress:()=>{P(''),(0,c.staffCode)('stamp').then($).catch(e=>P((0,o.plainError)(e)))}}):null]}),u?(0,m.jsx)(w,{venue:e,onJoined:e=>{M(e),v(null)}}):null,(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,canWrite:r=!0,onChange:h,onClose:x}){const[y,f]=(0,t.useState)(null),[w,b]=(0,t.useState)(!1),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),M=async e=>{b(!0),f(null);try{await e()}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{b(!1),k(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:x})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),y?(0,m.jsx)(i.Banner,{kind:y.kind,children:y.text}):null,r?(0,m.jsx)(i.Button,{label:w?'Saving\u2026':'Add a stamp',disabled:w||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>M(async()=>{const n=await(0,c.staffStamp)(e.id);h(n),f({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}):(0,m.jsx)(i.Muted,{children:"Ask a manager to add a stamp or use a reward."}),r&&!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),S===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:w,onPress:()=>M(async()=>{const n=await(0,c.staffRedeem)(e.id);h(n),f({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>k(null)})]}):r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>k(e.id)}):null]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[r?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>M(async()=>C(await(0,c.staffCode)('link',e.id)))}):null,s?'remove'===S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>M(async()=>{await(0,c.staffRemove)(e.id),h(null),x()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>k(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>k('remove')}):null]}),v?(0,m.jsx)(j,{c:v,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===S?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1421,[899,17,264,219,85,1275,777,1252,1255,804,1422,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canScan",{enumerable:!0,get:function(){return l}}),_e.CardScanner=function({onCard:t,onClose:n}){const f=(0,e.useRef)(null),[h,w]=(0,e.useState)('');return(0,e.useEffect)(()=>{if(!l())return void w('This browser can\u2019t scan. Type the card number or search by name instead.');let e=!1,n=null,c=null;const o=document.createElement('video');return o.setAttribute('playsinline','true'),o.muted=!0,Object.assign(o.style,{width:'100%',maxWidth:'360px',borderRadius:'12px',border:'2px solid #CFA45F'}),(async()=>{try{if(n=await navigator.mediaDevices.getUserMedia({video:{facingMode:'environment'}}),e)return void n.getTracks().forEach(e=>e.stop());o.srcObject=n,await o.play();const u=f.current;u?.appendChild(o);const l=new(0,window.BarcodeDetector)({formats:['qr_code']}),h=async()=>{if(!e){try{const e=await l.detect(o);for(const n of e){const e=(0,s.readCardQr)(String(n.rawValue??''));if(e)return void t(e)}}catch{}c=setTimeout(h,300)}};h()}catch{w('The camera didn\u2019t start. Allow the camera, or type the card number instead.')}})(),()=>{e=!0,c&&clearTimeout(c),n?.getTracks().forEach(e=>e.stop()),o.remove()}},[t]),(0,u.jsxs)(c.default,{style:{gap:8,alignItems:'center'},children:[(0,u.jsx)(c.default,{ref:f,style:{width:'100%',alignItems:'center'}}),h?(0,u.jsx)(o.Banner,{kind:"warn",children:h}):(0,u.jsx)(o.Muted,{center:!0,children:"Point the camera at the QR on the guest\u2019s card screen."}),(0,u.jsx)(o.Button,{kind:"ghost",label:"Close camera",onPress:n})]})};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),c=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),s=r(d[4]),u=r(d[5]);const l=()=>'undefined'!=typeof window&&'BarcodeDetector'in window&&!!navigator?.mediaDevices?.getUserMedia},1422,[17,219,85,777,1252,8]); +__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[l,i]=(0,s.useState)(''),[h,p]=(0,s.useState)(null),[j,f]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,g.staffServer)()||l.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,g.guestSearch)(l).then(p).catch(e=>f({kind:'warn',text:(0,o.plainError)(e)}))},300);return()=>clearTimeout(e)},[l]),(0,g.staffServer)()?b?(0,c.jsx)(w,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),i(''),f({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,c.jsx)(y,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,c.jsx)(k,{onOpen:v}):null,(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Find a guest: name, phone or email",value:l,onChangeText:i,autoCapitalize:"none",testID:"guest-search"}),(0,c.jsx)(a.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,h?(0,c.jsxs)(n.default,{style:{gap:8},testID:"guest-results",children:[h.profiles.map(e=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,u.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,c.jsx)(a.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),h.fromBookings.length?(0,c.jsx)(a.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,h.fromBookings.map((e,s)=>(0,c.jsx)(a.Card,{children:(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{weight:"medium",children:e.name}),(0,c.jsxs)(a.Muted,{size:12,children:[(0,u.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${x(e.lastVisit)}`:'']})]}),(0,c.jsx)(a.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),h.profiles.length||h.fromBookings.length?null:(0,c.jsx)(a.Muted,{children:"No guest found."}),(0,c.jsx)(a.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:l.trim(),phone:'',email:''})})]}):null]}):(0,c.jsx)(a.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=r(d[2]),n=(e=l)&&e.__esModule?e:{default:e},a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),g=r(d[7]),h=r(d[8]),c=r(d[9]);const x=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}},p=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 j({label:e,value:s}){return(0,c.jsxs)(n.default,{style:{minWidth:70,gap:2},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,c.jsx)(a.Muted,{size:12,children:e})]})}function y({seed:e,me:t,onMade:l,onCancel:i}){const[u,h]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,c.jsx)(n.default,{testID:"guest-make",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Make a guest profile"}),(0,c.jsx)(a.Field,{label:"Name",value:u.name,onChangeText:e=>h({...u,name:e}),testID:"guest-make-name"}),(0,c.jsx)(a.Field,{label:"Phone",value:u.phone,onChangeText:e=>h({...u,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,c.jsx)(a.Field,{label:"Email",value:u.email,onChangeText:e=>h({...u,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,c.jsx)(a.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,c.jsx)(a.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,c.jsx)(a.Banner,{kind:j.kind,title:j.text}):null,(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{l(await(0,g.guestMake)({...u,consent:x},t))}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1)}}}),(0,c.jsx)(a.Button,{label:"Cancel",kind:"ghost",onPress:i})]})]})})})}function f({g:e,me:t,onSaved:l}){const[h,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,c.jsxs)(n.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,c.jsx)(a.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,c.jsx)(a.Row,{style:{flexWrap:'wrap',gap:6},children:i.ALLERGENS.map(e=>(0,c.jsx)(a.Chip,{label:e.short,selected:h.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,u.toggleAllergy)(h,e.id))},e.id))}),h.map(e=>(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,c.jsx)(a.T,{weight:"medium",children:i.ALLERGENS.find(s=>s.id===e.allergen)?.short}),i.SEVERITIES.map(s=>(0,c.jsx)(a.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(h.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,c.jsx)(a.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,c.jsx)(a.Banner,{kind:y.kind,title:y.text}):null,(0,c.jsx)(a.Button,{label:w?'Saving\u2026':h.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{l(await(0,g.guestSignAllergies)(e.id,h,p))}catch(e){f({kind:'warn',text:(0,o.plainError)(e)})}finally{k(!1)}}})]})}function w({id:e,me:l,onClose:i,onErased:y}){const[w,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[D,I]=(0,s.useState)(!1),[T,B]=(0,s.useState)([]),[E,P]=(0,s.useState)(''),[M,A]=(0,s.useState)(''),[R,z]=(0,s.useState)(''),[N,O]=(0,s.useState)(null),F=(0,s.useCallback)(async()=>{try{const s=await(0,g.guestGet)(e);k(s),B(s.preferences),P(s.notes)}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{F()},[F]);const G=async e=>{C(!0),v(null);try{await e()}catch(e){v({kind:'warn',text:(0,o.plainError)(e)})}finally{C(!1),O(null)}};if(!w)return(0,c.jsx)(a.Card,{children:(0,c.jsx)(a.Muted,{children:b?b.text:'Opening the profile\u2026'})});const L=w.history,W=w.eraseRequest,$=!!w.erasedAt,_=JSON.stringify((0,u.tidyPrefs)(T))!==JSON.stringify(w.preferences)||E!==w.notes;return(0,c.jsxs)(n.default,{style:{gap:10},testID:"guest-profile",children:[(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{size:20,weight:"bold",children:w.name}),(0,c.jsx)(a.Muted,{children:[w.phone,w.email].filter(Boolean).join(' \xb7 ')||($?'Personal details erased':'')})]}),(0,c.jsx)(a.Button,{label:"Back",kind:"ghost",small:!0,onPress:i})]}),$?(0,c.jsx)(a.Banner,{kind:"warn",title:`Erased ${p(w.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,w.consentWithdrawnAt?(0,c.jsx)(a.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,c.jsx)(n.default,{testID:"guest-stats",children:(0,c.jsxs)(a.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,c.jsx)(j,{label:"Visits",value:L.visits}),(0,c.jsx)(j,{label:"Covers",value:L.covers}),(0,c.jsx)(j,{label:"No-shows",value:L.noShows}),(0,c.jsx)(j,{label:"Upcoming",value:L.upcoming})]})}),(0,c.jsxs)(a.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",x(L.firstVisit)," \xb7 last visit ",x(L.lastVisit),"."]})]})}),(0,c.jsx)(n.default,{testID:"guest-allergies",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Allergies"}),$?null:(0,c.jsx)(a.Button,{label:D?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>I(!D)})]}),w.allergiesSignedAt?(0,c.jsxs)(n.default,{style:{gap:2},children:[(0,c.jsx)(a.T,{weight:"medium",colour:w.allergies.length?h.colours.amber:h.colours.text,children:(0,u.allergyLine)(w.allergies)}),(0,c.jsxs)(a.Muted,{size:12,children:["Checked with the guest by ",w.allergiesSignedBy,", ",p(w.allergiesSignedAt),". Check again at every visit."]})]}):(0,c.jsx)(a.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),D?(0,c.jsx)(f,{g:w,me:l,onSaved:e=>{k(e),I(!1),v({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),$?null:(0,c.jsx)(n.default,{testID:"guest-prefs",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Preferences and notes"}),(0,c.jsxs)(a.Row,{style:{flexWrap:'wrap',gap:6},children:[T.map(e=>(0,c.jsxs)(n.default,{testID:"guest-pref",style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingLeft:14,paddingRight:2,borderRadius:22,borderWidth:1.5,borderColor:h.colours.gold,backgroundColor:h.colours.goldTint},children:[(0,c.jsx)(a.T,{size:14,weight:"semibold",colour:h.colours.goldLight,children:e}),(0,c.jsx)(t.GoldClose,{size:"sm",label:`Remove ${e}`,onPress:()=>B(T.filter(s=>s!==e))})]},e)),u.PREFERENCE_IDEAS.filter(e=>!T.includes(e)).slice(0,6).map(e=>(0,c.jsx)(a.Chip,{label:`${e}`,onPress:()=>B((0,u.tidyPrefs)([...T,e]))},e))]}),(0,c.jsxs)(a.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,c.jsx)(n.default,{style:{flex:1},children:(0,c.jsx)(a.Field,{label:"Add a preference",value:M,onChangeText:A,testID:"guest-pref-new"})}),(0,c.jsx)(a.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{B((0,u.tidyPrefs)([...T,M])),A('')}})]}),(0,c.jsx)(a.Field,{label:"Notes (the guest can ask to see these)",value:E,onChangeText:P,multiline:!0,testID:"guest-notes"}),_?(0,c.jsx)(a.Button,{label:S?'Saving\u2026':'Save preferences and notes',disabled:S,testID:"guest-prefs-save",onPress:()=>G(async()=>{const e=await(0,g.guestUpdate)(w.id,(0,u.tidyPrefs)(T),E,l);k(e),B(e.preferences),P(e.notes),v({kind:'success',text:'Saved'})})}):null]})})}),(0,c.jsx)(n.default,{testID:"guest-history",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:4},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Recent bookings"}),L.bookings.length?L.bookings.map((e,s)=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(a.T,{children:[x(e.date)," ",e.time]}),(0,c.jsxs)(a.Muted,{children:[e.covers," Covers \xb7 ",u.STATUS_WORDS[e.status]??e.status]})]},s)):(0,c.jsx)(a.Muted,{children:"No bookings match yet."}),w.loyalty?(0,c.jsxs)(a.Muted,{size:12,children:["Stamp card ",w.loyalty.cardNo,", joined ",x(w.loyalty.joined),"."]}):(0,c.jsx)(a.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,c.jsx)(n.default,{testID:"guest-consent",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,c.jsxs)(a.Muted,{size:12,children:["\u201c",w.consentText,"\u201d Taken by ",w.consentBy,", ",p(w.consentAt),"."]}),$||w.consentWithdrawnAt?null:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:w.marketingOk,onChange:e=>G(async()=>k(await(0,g.guestConsent)(w.id,e,!1,l))),testID:"guest-marketing"}),'withdraw'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>G(async()=>k(await(0,g.guestConsent)(w.id,!1,!0,l)))}),(0,c.jsx)(a.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>O('withdraw')})]})]})})}),w.canManage?(0,c.jsx)(n.default,{testID:"guest-manager",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:8},children:[(0,c.jsx)(a.T,{weight:"semibold",children:"Manager"}),(0,c.jsx)(a.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:S,onPress:()=>G(async()=>{const e=await(0,g.guestExport)(w.id,l),s=(0,u.exportFileName)(w.name,new Date);v({kind:'success',text:(0,g.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.'}),k(await(0,g.guestGet)(w.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?$?null:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsx)(a.Field,{label:"Ask to erase: reason",value:R,onChangeText:z,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,c.jsx)(a.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:S||R.trim().length<3,testID:"guest-erase-ask",onPress:()=>G(async()=>{await(0,g.guestEraseAsk)(w.id,R,l),z(''),k(await(0,g.guestGet)(w.id)),v({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,c.jsxs)(n.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,c.jsx)(a.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,c.jsxs)(a.Muted,{size:12,children:["Asked by ",W.askedBy,", ",p(W.askedAt),": \u201c",W.reason,"\u201d"]}),w.isOwner&&'waiting'===W.status?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!0,l),k(await(0,g.guestGet)(w.id))})}),(0,c.jsx)(a.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>G(async()=>{await(0,g.guestEraseDecide)(W.id,!1,l),k(await(0,g.guestGet)(w.id))})})]}):null,w.isOwner&&'approved'===W.status?'erase'===N?(0,c.jsxs)(a.Row,{style:{gap:8},children:[(0,c.jsx)(a.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>G(async()=>{await(0,g.guestEraseApply)(W.id,l),y()})}),(0,c.jsx)(a.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>O(null)})]}):(0,c.jsx)(a.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>O('erase')}):null,w.isOwner?null:(0,c.jsx)(a.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),w.audit?.length?(0,c.jsxs)(n.default,{style:{gap:2},testID:"guest-audit",children:[(0,c.jsx)(a.Muted,{weight:"medium",children:"Audit trail"}),w.audit.slice(0,8).map((e,s)=>(0,c.jsxs)(a.Muted,{size:12,children:[p(e.at)," \xb7 ",u.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,b?(0,c.jsx)(a.Banner,{kind:b.kind,title:b.text}):null]})}function k({onOpen:e}){const[t,l]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,g.guestEraseList)().then(l).catch(()=>l([]))},[]),t?.length?(0,c.jsx)(n.default,{testID:"guest-erase-queue",children:(0,c.jsx)(a.Card,{children:(0,c.jsxs)(n.default,{style:{gap:6},children:[(0,c.jsxs)(a.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,c.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.default,{style:{flex:1},children:[(0,c.jsx)(a.T,{children:s.name}),(0,c.jsxs)(a.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,c.jsx)(a.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1423,[17,779,85,777,845,1252,1424,1425,804,8]); +__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'},1424,[845]); +__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()})},1425,[899,1424,1255]); +__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,canWrite:t=!0}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e,canWrite:t}),(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 m=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)}},f=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e,canWrite:t=!0}){const[s,a]=(0,n.useState)(''),[x,p]=(0,n.useState)(null),[b,y]=(0,n.useState)(''),[w,k]=(0,n.useState)((0,u.redeemKey)()),[S,T]=(0,n.useState)(null),[C,v]=(0,n.useState)(!1),P=(0,u.poundsToPence)(b);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:t?'Check a gift card or take it off the bill':'Check a gift card'}),(0,j.jsx)(r.Field,{label:"Gift card code",value:s,autoCapitalize:"characters",onChangeText:e=>{a(e),p(null),k((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:C?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:C||s.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{v(!0),T(null);try{const e=await(0,h.giftCheck)(s);p(e),e.found||T({kind:'warn',text:'No gift card with that code here.'})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}}),x?.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)(s)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(x.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[x.status]??x.status," \xb7 of ",(0,o.gbp)(x.initialPence),x.expiresAt?` \xb7 use by ${m(x.expiresAt)}`:'','wix'===x.source?' \xb7 old website bookings card':'']}),'active'===x.status&&t?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{money:!0,label:"Amount to take off \xa3",value:b,onChangeText:y,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:C?'Taking it off\u2026':P?`Take ${(0,o.gbp)(P)} off the card`:'Take it off the card',disabled:C||!P||P>x.balancePence,testID:"gift-redeem",onPress:async()=>{v(!0),T(null);try{const t=await(0,h.giftRedeem)(s,P,w,e);p({...x,...t,found:!0}),y(''),k((0,u.redeemKey)()),T({kind:'success',text:`${t.already?'Already taken: ':'Taken '}${(0,o.gbp)(t.redeemedPence)}. ${(0,o.gbp)(t.balancePence)} left on the card.`})}catch(e){T({kind:'warn',text:(0,c.plainError)(e)})}finally{v(!1)}}})]}):'active'!==x.status||t?null:(0,j.jsx)(r.Muted,{children:"Ask a manager to take an amount off the card."})]}):null,(0,j.jsx)(f,{m:S})]})})})}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,{money:!0,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 ",m(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(f,{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 W=(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:!W,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:W}),'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,{money:!0,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,{money:!0,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 ${m(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)(f,{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 ",m(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(f,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1426,[805,1427,17,85,777,851,1252,1253,1254,899,1255,804,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return null}},1427,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.newerRelease=r,_e.startForegroundRefresh=function(n={}){if('undefined'==typeof document)return()=>{};let o='hidden'===document.visibilityState?Date.now():0,c=!1;const s=n.reload??(()=>location.reload()),u=async()=>{if(!c){c=!0;try{await Promise.race([e.mutationQueue.retryNow(),new Promise(e=>setTimeout(e,4e3))]),n.onWake?.();const t=await(navigator.serviceWorker?.getRegistration?.().catch(()=>{}));if(await(t?.update?.().catch(()=>{})),t?.waiting){try{t.waiting.postMessage({type:'SKIP_WAITING'})}catch{}return void setTimeout(s,3e3)}await r().catch(()=>!1)&&s()}finally{c=!1}}},l=()=>{if('hidden'===document.visibilityState)return void(o=Date.now());const n=o?Date.now()-o:0;o=0,e.mutationQueue.retryNow(),n>=t&&u()},f=()=>{e.mutationQueue.retryNow()};document.addEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.addEventListener(e,f);return()=>{document.removeEventListener('visibilitychange',l);for(const e of['focus','online','pageshow'])window.removeEventListener(e,f)}},_r(d[0]);var e=_r(d[1]);const t=3e4,n=e=>(e.match(/_expo\/static\/js\/web\/[A-Za-z0-9_.-]+\.js(\?v=[0-9a-f]+)?/)??[])[0]??null;function o(){try{const e=[...document.querySelectorAll('script[src]')].map(e=>e.src).find(e=>/_expo\/static\/js\/web\//.test(e));return e?n(e):null}catch{return null}}async function r(e=fetch){const t=o();if(!t)return!1;const r=location.pathname.replace(/[^/]*$/,''),c=await e(`${r}index.html?fresh=${Date.now()}`,{cache:'no-store'});if(!c.ok)return!1;const s=n(await c.text());return!!s&&s!==t}},1428,[219,976]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, type the figures (including cash paid out of the till) and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1429,[17,85,777,804,914,1022,899,8]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function({go:e,only:W}={}){const{rid:ie,r:ae,now:oe,today:de,me:re,role:ue}=(0,w.useCtx)(1e4),ce=(0,A.useBookings)(ie),he=(0,w.useInStaffApp)(),ge=(0,w.useShiftManager)(),be=(0,A.useWaitlist)(ie),[pe,ke]=((0,A.useStore)(e=>e.alertAcks),(0,O.useState)(de)),xe=(0,K.useFrontDoor)(pe),me=(0,y.useBookingWrite)(),we=(0,f.useSeatClearFinish)(),[ye,je]=(0,O.useState)(''),[fe,Ie]=(0,O.useState)(!1),[Be,De]=(0,O.useState)(2),Se=pee.date===pe).sort((e,s)=>e.time.localeCompare(s.time)),Ce=be.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),Te=$e.filter(e=>'noshow'===e.status),Le=(0,ee.useSync)(e=>!!e.venueId&&'guest'!==e.kind),ve=$e.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),Ne=(0,p.cancelledDayTally)(ce,pe),Pe=(0,p.cancelledTallyWords)(Ne,pe===de?'today':'that day'),Oe=$e.filter(e=>!e.walkIn),We=$e.filter(e=>e.walkIn),Me=ce.filter(e=>'pending'===e.status&&e.date>=de).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[Ee,Ae]=(0,O.useState)(null),Re=(0,H.parseYmd)(pe);Re.setHours(12);const ze=(0,le.hoursFor)(ae,Re),He=ze?.open??new Date(`${pe}T12:00:00`),Ge=ze?.close??new Date(`${pe}T21:00:00`),Fe=ze||$e.length?Se?'No one seated that day':pe===de?'No bookings yet today':'No bookings yet':pe===de?'Closed today':'Closed that day',Ue=Ce.length>0||fe||'waitlist'===W?(0,ne.jsxs)(M.default,{style:{gap:10},children:[(0,ne.jsx)(U.SectionHead,{title:`Waitlist (${Ce.length})`,sub:`New party waits about ${(0,G.estimateWait)(Ce.length+1,ae.settings.turnMins,1)} min (estimate)`}),Ce.map((e,s)=>(0,ne.jsxs)(M.default,{style:E.styles.card,children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,ne.jsxs)(E.Muted,{children:[(0,H.minsBetween)(new Date(e.joinedAt),oe)," min \xb7 est. ",(0,G.estimateWait)(s+1,ae.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,ne.jsx)(E.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,ne.jsxs)(E.Row,{gap:6,children:['waiting'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>A.repo.waitlist.setStatus(e.id,'notified')}):null,we.ok?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",onPress:()=>A.repo.waitlist.setStatus(e.id,'seated')}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>A.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(a.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:ye,onChangeText:je,style:[E.styles.input,{flex:1}]}),(0,ne.jsx)(E.Stepper,{value:Be,onChange:De,min:1,max:12,label:"party"})]}),(0,ne.jsx)(E.Button,{kind:"secondary",label:"Add to waitlist",disabled:ye.trim().length<2,onPress:()=>{A.repo.waitlist.join(ie,ye.trim(),Be),je('')}})]}):(0,ne.jsx)(E.Button,{kind:"ghost",label:"Open waitlist",onPress:()=>Ie(!0),accessibilityLabel:"Open the empty waitlist to add a waiting party"});return'waitlist'===W?(0,ne.jsx)(M.default,{style:{gap:12},testID:"bookings-waitlist-only",children:Ue}):(0,ne.jsxs)(M.default,{style:{gap:12},children:[(0,ne.jsx)(l.BookingSaveBanner,{rid:ie}),e&&!he&&'staff'!==ue?(0,ne.jsx)(E.Button,{testID:"bookings-dashboard-top",label:"Bookings dashboard",accessibilityLabel:"Open Bookings dashboard: table plan, Timeline, today's guests and Covers",onPress:()=>e('more','serviceboard'),style:{width:'100%',minHeight:60}}):null,s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===ie)&&!he&&'staff'!==ue?(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"table"}):null,!s.IS_WILDINGS&&!ae.settings.hotel?.enabled||he||'staff'===ue?null:(0,ne.jsx)(i.VenueRequestList,{rid:ie,kind:"room",hotel:ae.settings.hotel??n.WILDINGS_HOTEL}),(0,ne.jsx)(Q.BookingsDayNav,{today:de,date:pe,onDate:ke,count:e=>ce.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=ce.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'Cover':'Covers'}`}}),(0,ne.jsx)(M.default,{testID:"bookings-day-graph",style:{overflow:'visible'},children:(0,ne.jsx)(te.DayGraph,{bare:!0,fill:!0,todays:$e,open:He,close:Ge,now:oe,turnBase:ae.settings.turnMins,height:128,past:Se,closed:!ze,emptyText:Fe})}),Se?(0,ne.jsxs)(M.default,{testID:"bookings-past-totals",style:[E.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,Q.longDay)(pe)}: ${Oe.length} tables, ${ve} Covers, ${$e.filter(e=>'finished'===e.status).length} finished, ${Te.length} no-shows, ${$e.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,ne.jsxs)(E.T,{size:17,weight:"semibold",children:["That day: ",Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']}),(0,ne.jsxs)(E.T,{size:16,colour:F.colours.text,children:[$e.filter(e=>'finished'===e.status).length," finished \xb7 ",Te.length," no-show",1===Te.length?'':'s'," \xb7 ",$e.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,ne.jsx)(E.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,ne.jsx)(M.default,{testID:"bookings-summary",children:(0,ne.jsxs)(E.T,{weight:"semibold",children:[Oe.length," booking",1===Oe.length?'':'s',We.length?` \xb7 ${We.length} walk-in${1===We.length?'':'s'}`:''," \xb7 ",ve," ",1===ve?'Cover':'Covers']})}),he||'staff'===ue||Se?null:(0,ne.jsx)(h.BookingsMatchStatus,{}),(0,ne.jsx)(M.default,{testID:"cancelled-day-tally",accessible:!0,accessibilityLabel:Pe,style:{alignItems:'center'},children:(0,ne.jsx)(E.T,{size:15,colour:F.colours.muted,center:!0,children:Pe})}),(0,ne.jsxs)(M.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[Se||he&&!ge?null:(0,ne.jsx)(T.QuietButton,{label:"New booking",onPress:xe.openBooking,testID:"add-booking",disabled:!me.ok,accessibilityHint:me.hint}),he&&ge&&pe===de?(0,ne.jsx)(T.QuietButton,{label:"Walk-in",onPress:xe.openWalkIn,testID:"add-walkin",disabled:!me.ok,accessibilityHint:me.hint}):null,pe===de?(0,ne.jsx)(L.CloseGardenButton,{quiet:!0,short:!0,rid:ie,r:ae,now:oe,by:re}):null]}),Me.length?(0,ne.jsxs)(M.default,{testID:"pending-requests",style:[E.styles.card,{borderColor:F.colours.amber,gap:8}],children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:F.colours.amber,children:["Needs confirming (",Me.length,")"]}),(0,ne.jsx)(E.Muted,{children:"Online requests outside your auto-accept rules. Check the details before confirming."}),Me.map(e=>(0,ne.jsxs)(M.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:F.colours.border},children:[(0,ne.jsxs)(E.T,{weight:"semibold",children:[e.name," \xb7 ",e.partySize," ",1===e.partySize?'Cover':'Covers']}),(0,ne.jsxs)(E.Muted,{children:[(0,H.niceDate)((0,H.parseYmd)(e.date))," at ",e.time," \xb7 ",e.ref," \xb7 ",e.phone??'no phone']}),e.notes?(0,ne.jsxs)(E.T,{size:16,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`pending-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae}),'staff'!==ue&&((0,N.needsHoldOk)(e)||e.date===de&&e.holdOk&&(e.holds??[]).some(e=>!e.served)&&'seated'===e.status)?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,N.needsHoldOk)(e)?(0,ne.jsx)(E.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${e.ref}`,onPress:()=>(0,v.confirmHolds)(e.id,re)}):null,e.holdOk&&'seated'===e.status?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,v.serveHolds)(e,re,'owner')}):null]}):null,Ee===e.id?(0,ne.jsxs)(M.default,{style:{gap:6},children:[(0,ne.jsxs)(E.T,{size:14,children:["Are you sure? ",e.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{A.repo.bookings.decide(e.id,'declined',re),Ae(null)}}),(0,ne.jsx)(E.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>Ae(null)})]})]}):me.ok?(0,ne.jsxs)(E.Row,{gap:6,children:[(0,ne.jsx)(E.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>A.repo.bookings.decide(e.id,'confirmed',re)}),(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>Ae(e.id)}),(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"change"})]}):(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id})]},e.id))]}):null,0===$e.length?(0,ne.jsx)(E.Muted,{children:"No bookings for this day yet."}):null,$e.map(e=>{const s='confirmed'===e.status&&pe===de&&(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)>15,t=(0,B.depositState)(e),n=(0,B.depositBadge)(e,z.gbp);return(0,ne.jsxs)(M.default,{testID:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?`booking-seated-${e.id}`:`booking-row-${e.id}`,style:[E.styles.card,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,P.seatedHighlightStyle)({borderColor:(0,N.hasAllergens)(e)?F.colours.red:F.colours.goldLight}):{borderColor:(0,N.hasAllergens)(e)?F.colours.red:s?F.colours.amber:F.colours.hairline,opacity:['finished','cancelled'].includes(e.status)?.55:1}],children:[(0,ne.jsx)(v.AllergenBar,{b:e}),(0,ne.jsx)(l.BookingNotSavedLine,{b:e}),(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsxs)(E.Row,{gap:6,style:{flex:1,minWidth:0,alignItems:'center'},children:[(0,ne.jsxs)(E.T,{weight:"semibold",colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?P.SEATED_FG:F.colours.text,style:{flexShrink:1},children:[e.time," \xb7 ",(0,K.walkInLabel)(e)]}),(0,N.hasAllergens)(e)?(0,ne.jsx)(_.AllergyIcon,{text:(0,N.allergenText)(e),size:20,colour:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?'#7A4A00':F.colours.amber,ink:(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?F.colours.gold:F.colours.bg,testID:`booking-allergy-${e.id}`}):null]}),(0,ne.jsx)(E.Badge,{kind:'seated'===(0,N.shownStatus)(e)?'ok':'noshow'===e.status?'red':'confirmed'===e.status?'gold':'pending'===e.status?'amber':'neutral',label:'noshow'===e.status?'No-show':'pending'===e.status?'Needs confirming':(0,N.shownStatus)(e)[0].toUpperCase()+(0,N.shownStatus)(e).slice(1)})]}),n?(0,ne.jsx)(I.DepositChip,{b:e,money:!0,big:!0,testID:`deposit-chip-${e.id}`}):null,(0,P.isSeatedHighlight)((0,N.shownStatus)(e))?(0,ne.jsxs)(E.T,{size:14,colour:P.SEATED_MUTED,children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}):(0,ne.jsxs)(E.Muted,{children:[e.table?(0,Y.tableCardLabel)(e.table):e.walkIn?'Table to assign':'Table TBC'," \xb7 ",e.ref]}),e.notes?(0,ne.jsxs)(E.T,{size:16,testID:`booking-notes-${e.id}`,children:["Notes: ",e.notes]}):null,(0,D.guestChangeLine)(e)?(0,ne.jsx)(E.T,{size:15,colour:F.colours.amber,testID:`booking-guest-change-${e.id}`,children:(0,D.guestChangeLine)(e)}):null,(0,b.bookingExtras)(e)?(0,ne.jsx)(E.T,{size:15,testID:`booking-extras-${e.id}`,children:(0,b.bookingExtras)(e)}):null,(0,ne.jsx)(v.NeedsPills,{b:e,r:ae,only:"rules"}),(0,b.historyLines)(e)[0]?(0,ne.jsxs)(E.Muted,{size:13,testID:`booking-last-change-${e.id}`,children:["Last change: ",(0,b.historyLines)(e)[0]]}):null,n?(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[Se||!(0,B.canTickDeposit)(e)||['cancelled','finished'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${e.id}`,accessibilityLabel:`Mark deposit paid for ${(0,K.walkInLabel)(e)}`,onPress:()=>A.repo.bookings.update(e.id,{depositPaid:e.depositDue??0,depositPaidBy:re,depositPaidAt:(new Date).toISOString()})}),Se?null:(0,ne.jsx)($.WixDepositLink,{b:e,rid:ie}),Se||!me.ok||he&&!ge?null:(0,ne.jsx)(S.WaiveDepositButton,{b:e,who:re,small:!0}),'waived'===t&&e.depositWaived?(0,ne.jsx)(E.Muted,{size:13,testID:`deposit-waived-${e.id}`,children:(0,B.waiverText)(e.depositWaived)}):null,'paid'===t&&e.depositPaidBy?(0,ne.jsx)(E.Muted,{size:13,children:'Wix deposit link'===e.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${e.depositPaidBy}`}):null]}):null,e.walkIn?null:(0,ne.jsxs)(E.Muted,{children:[(0,Z.bookingSource)(e),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']}),e.allergies.length?(0,ne.jsx)(E.Row,{wrap:!0,gap:4,children:e.allergies.map(e=>(0,ne.jsx)(E.Badge,{kind:"red",label:`${(0,R.allergenLabel)(e.allergen)} \xb7 ${(0,R.severityLabel)(e.severity)}`},e.allergen))}):null,(0,N.hasAllergens)(e)&&!['cancelled','noshow'].includes(e.status)?(0,ne.jsx)(J.BookingAllergyChain,{b:e,me:re}):null,e.walkIn?null:(0,ne.jsx)(X.ConfirmTimeline,{refId:e.id,noPhone:!!e.source&&!e.phone}),s?(0,ne.jsxs)(E.T,{size:13,colour:F.colours.amber,children:["Running ",(0,H.minsBetween)(new Date(`${e.date}T${e.time}:00`),oe)," min late. Call them, then mark no-show if needed."]}):null,me.ok?(0,ne.jsx)(c.BookingEditButton,{rid:ie,booking:e,who:re,role:ue,inStaffApp:he,shiftManager:ge,big:!0,testID:`edit-booking-${e.id}`}):null,(0,ne.jsxs)(E.Row,{wrap:!0,gap:6,children:[(0,ne.jsx)(u.BookingTableButton,{rid:ie,booking:e,readOnly:Se||!me.ok,turnBase:ae.settings.turnMins,canClear:we.ok}),me.ok?null:(0,ne.jsx)(M.default,{accessible:!0,accessibilityLabel:j.BOOKING_VIEW_ONLY,children:(0,ne.jsx)(E.T,{children:j.BOOKING_VIEW_ONLY})}),me.ok?(0,ne.jsxs)(ne.Fragment,{children:[Se||e.table||!['seated','confirmed'].includes(e.status)?null:(0,ne.jsx)(E.Button,{small:!e.walkIn,kind:e.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>xe.assignTable(e)}),!Se&&['seated','confirmed'].includes(e.status)?(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables',testID:`combine-${e.id}`,accessibilityLabel:`${(0,Y.tablesOf)(e.table).length>1?'Change tables':'Combine tables'} for ${(0,K.walkInLabel)(e)}`,onPress:()=>xe.combineTables(e)}):null,Se||'confirmed'!==e.status?null:(0,ne.jsxs)(ne.Fragment,{children:[we.ok&&e.date===de?(0,ne.jsx)(E.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,K.walkInLabel)(e)} now`,onPress:()=>(0,K.seatBookingNow)(ie,e)}):null,(0,ne.jsx)(E.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>A.repo.bookings.setStatus(e.id,'noshow')})]}),Se||e.walkIn?null:(0,ne.jsx)(r.CancelBookingButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),small:!0,onDone:()=>{}}),Se||e.walkIn?null:(0,ne.jsx)(r.ReinstateBookingButton,{b:e,name:(0,K.walkInLabel)(e),today:de}),Se||'seated'!==e.status?null:(0,ne.jsx)(V.FinishButton,{rid:ie,b:e,name:(0,K.walkInLabel)(e),allowed:we.ok,hint:we.hint,small:!0,a11y:`Finished: ${(0,K.walkInLabel)(e)}, table needs clearing`,testID:`bookings-finish-${e.id}`}),['confirmed','pending'].includes(e.status)&&e.date>=de?(0,ne.jsx)(se.WhatsAppGuest,{b:e,rid:ie,kind:"auto"}):null,he?null:(0,ne.jsx)(C.CopyReviewLink,{rid:ie,bookingId:e.id}),!Se&&e.walkIn?(0,ne.jsx)(d.CancelWalkInButton,{rid:ie,b:e,small:!0}):null,!Se&&e.walkIn?(0,ne.jsx)(d.ReinstateWalkInButton,{rid:ie,b:e,today:de,small:!0}):null,(0,ne.jsx)(q.BookingUndo,{b:e,rid:ie,today:de,who:(0,K.walkInLabel)(e),allowed:we.ok})]}):null]}),'noshow'===e.status&&'paid'===t?(0,ne.jsx)(E.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},e.id)}),(0,ne.jsx)(x.CancellationsSection,{testID:"bookings-cancellations",items:(0,k.cancellationsFor)(ce,pe,e=>e.walkIn?`Walk-in ${e.ref}`:(e.name??'').replace(' (example)','')),dayWord:pe===de?'today':'that day'}),(0,ne.jsxs)(E.Card,{children:[(0,ne.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"No-shows"}),(0,ne.jsx)(E.Badge,{kind:Te.length?'red':'ok',label:`${Te.length} ${pe===de?'today':(0,H.niceDate)((0,H.parseYmd)(pe)).slice(0,6)}${Le||o.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,ne.jsx)(E.Muted,{children:Te.length?`Marked no-show today: ${Te.slice(0,6).map(e=>`${e.time} ${(0,K.walkInLabel)(e)}`).join(', ')}${Te.length>6?` and ${Te.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,ne.jsx)(t.GreensideCashOnly,{}):(0,ne.jsxs)(E.Card,{children:[(0,ne.jsx)(E.T,{weight:"semibold",children:"Deposits"}),(0,ne.jsx)(E.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,B.depositOf)(ae.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,z.gbp)(e.perPersonPence)} per adult for parties of ${e.fromParty} or more (children never pay; staff can waive one on the booking). Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,ne.jsx)(E.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),Ue,xe.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),l=_r(_d[2]),n=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),y=_r(_d[17]),j=_r(_d[18]),f=_r(_d[19]),I=_r(_d[20]),B=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),$=_r(_d[24]),C=_r(_d[25]),T=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),P=_r(_d[30]),O=_r(_d[31]),W=_r(_d[32]),M=(e=W)&&e.__esModule?e:{default:e},E=_r(_d[33]),_=_r(_d[34]),A=_r(_d[35]),R=_r(_d[36]),z=_r(_d[37]),H=_r(_d[38]),G=_r(_d[39]),F=_r(_d[40]),U=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),Y=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),J=_r(_d[47]),X=_r(_d[48]),Z=_r(_d[49]),ee=_r(_d[50]),se=_r(_d[51]),te=_r(_d[52]),le=_r(_d[53]),ne=_r(_d[54])},1430,[805,1427,1095,1262,1431,812,822,1117,1118,1091,1122,1432,1114,1119,1402,1403,1057,1338,996,1120,1089,841,1381,1125,1434,1231,1435,1394,1078,1055,1090,17,85,777,1358,858,845,851,863,1316,804,1178,1098,1115,998,1355,1062,1162,1436,1222,899,1180,1399,862,8]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestList=function({rid:e,kind:n,hotel:c}){const y=(0,r.useSync)(),p='staff'===y.kind&&y.venueSlug===(0,s.queuedDatabaseSlug)(e)&&!!y.venueId&&(!['greenside','kirkton','abbotsford'].includes(e)&&!(0,s.isQueuedVenue)(e)||y.perms.includes('*')||y.perms.includes('venue.settings')),f=p&&(y.perms.includes('*')||y.perms.includes('room'===n||(0,s.isQueuedVenue)(e)||['greenside','kirkton','abbotsford'].includes(e)?'venue.settings':'bookings.manage')),[h,b]=(0,t.useState)([]),[j,q]=(0,t.useState)(''),[x,k]=(0,t.useState)(null),v=(0,t.useCallback)(async()=>{if(p)try{b(await(0,o.listVenueRequests)(y.venueId,n)),q('')}catch(e){q((0,o.requestMessage)(e))}},[p,n,y.venueId]);(0,t.useEffect)(()=>{const e=setTimeout(()=>{v()},0),s=setInterval(()=>{v()},15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v]);const T=h.filter(e=>e.venue_id===y.venueId);if(!p)return null;const I=async(e,s)=>{if(!x){k(e);try{await(0,o.decideVenueRequest)(e,s),await v()}catch(e){q((0,o.requestMessage)(e))}finally{k(null)}}};return(0,u.jsxs)(d.default,{testID:`venue-${n}-requests`,style:{gap:12,alignItems:'stretch'},children:[(0,u.jsx)(l.H2,{children:'room'===n?'Room requests':'Table requests'}),(0,u.jsx)(l.T,{center:!0,children:"Requested bookings need a staff decision. No email or text is sent. Contact the guest to confirm arrangements."}),(0,u.jsx)(l.Button,{kind:"secondary",label:`Refresh ${n} requests`,onPress:()=>{v()}}),j?(0,u.jsx)(l.Banner,{kind:"warn",title:"Requests",children:j}):null,T.length||j?null:(0,u.jsxs)(l.T,{center:!0,children:["No ",n," requests yet."]}),T.map(e=>(0,u.jsx)(l.Card,{style:{alignItems:'stretch'},children:(0,u.jsxs)(d.default,{testID:`venue-request-${e.id}`,style:{gap:10},children:[(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.payload.name}),(0,u.jsx)(l.Badge,{kind:'requested'===e.status?'amber':'confirmed'===e.status?'ok':'neutral',label:'requested'===e.status?'Requested':'confirmed'===e.status?'Confirmed':'Declined'})]}),(0,u.jsx)(l.T,{children:'table'===n?`${e.payload.date} \xb7 ${e.payload.service?e.payload.service+' \xb7 ':''}${e.payload.time} \xb7 ${e.payload.covers} Covers`:`${e.payload.checkIn} to ${e.payload.checkOut} \xb7 ${c?.roomTypes.find(s=>s.id===e.payload.roomType)?.name||e.payload.roomType} \xb7 ${e.payload.guests} guests`}),'room'===n?(0,u.jsxs)(l.T,{children:["Add dinner: ",e.payload.addDinner?'Yes \u2014 arrange with guest':'No']}):null,(0,u.jsxs)(l.T,{children:[e.payload.phone," \xb7 ",e.payload.email]}),e.payload.notes?(0,u.jsxs)(l.T,{children:["Notes: ",e.payload.notes]}):null,'requested'===e.status&&f?(0,u.jsxs)(l.Row,{wrap:!0,children:[(0,u.jsx)(l.Button,{label:x===e.id?'Saving\u2026':'Confirm',testID:`request-confirm-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'confirmed')}}),(0,u.jsx)(l.Button,{label:"Decline",kind:"secondary",testID:`request-decline-${e.id}`,disabled:!!x,onPress:()=>{I(e.id,'declined')}})]}):null,e.booking_id?(0,u.jsx)(l.T,{children:"Confirmed table booking is in the bookings list."}):null]})},e.id))]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),d=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),u=_r(_d[6])},1431,[806,17,85,777,899,1266,8]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingsMatchStatus=function(){const e=(0,l.useSync)(e=>'staff'===e.kind?e.venueId:void 0),[f,b]=(0,t.useState)(null),[x,y]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!e)return;let t,n=!0;try{t=(0,o.getSupabase)()}catch{return}const s=()=>t.rpc('bookings_match_status',{p_venue:e}).then(({data:e,error:t})=>{n&&!t&&e&&b(e)},()=>{});s();const i=setInterval(s,6e4);return()=>{n=!1,clearInterval(i)}},[e]);const _=(0,i.matchLine)(f);if(!_)return null;const k=f?.items??[],v=(f?.need_look??0)>0||!1===f?.ok;return(0,h.jsxs)(s.default,{testID:"bookings-match",style:{alignItems:'center',gap:4},children:[(0,h.jsx)(n.default,{accessibilityRole:k.length?'button':'text',accessibilityLabel:k.length?`${_}. ${x?'Hide':'Show'} the list`:_,disabled:!k.length,onPress:()=>y(!x),style:{minHeight:44,justifyContent:'center',paddingHorizontal:12},children:(0,h.jsxs)(u.T,{size:16,center:!0,weight:"semibold",colour:v?c.colours.amber:c.colours.goldLight,children:[_,k.length?x?' \u25b2':' \u25bc':'']})}),x?(0,h.jsxs)(s.default,{testID:"bookings-match-list",style:{gap:4,maxWidth:720},children:[k.map((e,t)=>(0,h.jsx)(u.T,{size:15,center:!0,colour:c.colours.text,children:(0,i.itemLine)(e)},t)),(0,h.jsx)(u.Muted,{center:!0,children:f?.auto_fix?'Checked every night at midnight.':'Checked every night at midnight. Fixing is switched off.'})]}):null]})};var t=r(d[0]),n=e(r(d[1])),s=e(r(d[2])),i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8])},1432,[17,385,85,1433,899,928,804,777,8]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"plainSite",{enumerable:!0,get:function(){return o}}),e.matchLine=function(t){if(!t||!t.ran)return null;if(!1===t.ok)return`${i}: couldn\u2019t check at ${n(t.last_run_at)}, trying again`;const o=t.need_look??0,s=t.fixed_today??0,l=[o?i:`${i} \u2713`];s&&l.push(`${s} fixed today`);o&&l.push(`${o} need${1===o?'s':''} a look`);return l.join(' \xb7 ')},e.itemLine=function(n){const i=(n.fields??[]).map(n=>t[n]??n).join(', '),s=[n.ref,n.name].filter(Boolean).join(' '),l=[n.date?n.date.split('-').reverse().join('/'):'',n.time].filter(Boolean).join(' '),c='wix'===n.winner?'Website is newer':'covercharge'===n.winner?'CoverCharge is newer':'';return[s,l,i&&`differs: ${i}`,c,o(n.note)].filter(Boolean).join(' \xb7 ')};const t={name:'name',phone:'phone',email:'email',date:'date',time:'time',covers:'covers',notes:'notes',table:'table',status:'status',dog:'dog',allergies:'allergies',create:'not on the website',import:'not in CoverCharge'},n=t=>t?new Date(t).toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'}):'',i='Bookings match the website',o=t=>t?t.replace(/\bon Wix\b/g,'on the website').replace(/\bWix\b/g,'the website'):t},1433,[]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"untilWords",{enumerable:!0,get:function(){return w}}),_e.WixDepositLink=function({b:e,rid:x}){const f=(0,r.useRestaurant)(x),[S,j]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[L,I]=(0,s.useState)(null),[$,v]=(0,s.useState)(''),[P,T]=(0,s.useState)(''),[A,_]=(0,s.useState)(''),M=(0,c.depositOf)(f?.settings),O=e;if(n.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(x)||!f||!(0,c.canSendDepositLink)(O,M))return null;const B='open'===O.depositLink?.state,R=async()=>{j(!0),D(!0),T(''),I(null);try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-link',{body:{booking_id:e.id}});if(n||!t)return void T(y);if(!t.ok||!t.url)return void T(t.off?y:String(t.error??y));const s={url:t.url,amountPence:t.amountPence,expiresAt:t.expiresAt};I(s),v((0,c.depositLinkMessage)({name:e.name,venue:f.name,partySize:e.partySize,date:e.date,time:e.time,amountPence:s.amountPence,url:s.url,expiresAt:s.expiresAt,terms:(0,c.depositTerms)(M)}))}catch{T(y)}finally{D(!1)}},W=async()=>{_('Checking\u2026');try{const{data:t,error:n}=await(0,h.getSupabase)().functions.invoke('wix-deposit-check',{body:{booking_id:e.id}});_(n||!t||t.off?'Website bookings deposit links are switched off, so nothing was checked.':'Checked with website bookings. If the guest has paid, the badge shows Deposit paid on website bookings.')}catch{_('Could not reach website bookings. Try again in a minute.')}},z=L?(0,k.waMeLink)(e.phone,$):null,E=L&&e.phone?(0,p.smsLink)(e.phone,$):null,U=L&&e.email?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(`${f.name} deposit`)}&body=${encodeURIComponent($)}`:null,F='undefined'!=typeof navigator&&!!navigator.clipboard,G=e=>{e&&o.default.openURL(e).catch(()=>{})};return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:B?'Send deposit link again':'Send deposit link',testID:`deposit-link-${e.id}`,accessibilityLabel:`${B?'Send the deposit link again to':'Send a website bookings deposit link to'} ${e.name}`,onPress:()=>{R()}}),B?(0,g.jsx)(d.Button,{small:!0,kind:"secondary",label:"Check if paid",testID:`deposit-check-${e.id}`,accessibilityLabel:`Check with website bookings if ${e.name} has paid the deposit`,onPress:()=>{W()}}):null,A?(0,g.jsx)(d.Muted,{size:13,children:A}):null,(0,g.jsx)(d.Sheet,{visible:S,onClose:()=>j(!1),title:"Send deposit link",testID:`deposit-link-sheet-${e.id}`,children:(0,g.jsxs)(l.default,{style:{gap:10},children:[C?(0,g.jsx)(d.T,{children:"Asking website bookings for the link\u2026"}):null,P?(0,g.jsx)(d.T,{colour:b.colours.amber,testID:"deposit-link-error",children:P}):null,L?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.T,{weight:"semibold",children:`Deposit ${(0,u.gbp)(L.amountPence)} for ${e.partySize} guests.${L.expiresAt?` Link works until ${w(L.expiresAt)}.`:''}`}),(0,g.jsx)(d.T,{children:"Message to the guest (you can change it)"}),(0,g.jsx)(t.TextInput,{accessibilityLabel:"Message to the guest",testID:"deposit-link-message",value:$,multiline:!0,onChangeText:v,style:{minHeight:140,borderRadius:10,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface2,color:b.colours.text,padding:10,fontSize:15}}),(0,g.jsxs)(d.Row,{wrap:!0,gap:8,children:[E?(0,g.jsx)(d.Button,{label:"Text",testID:"deposit-link-sms",accessibilityLabel:`Open a text message to ${e.name} with the deposit link`,onPress:()=>G(E)}):null,z?(0,g.jsx)(d.Button,{kind:"secondary",label:"WhatsApp",testID:"deposit-link-wa",accessibilityLabel:`Open WhatsApp to ${e.name} with the deposit link`,onPress:()=>G(z)}):null,U?(0,g.jsx)(d.Button,{kind:"secondary",label:"Email",testID:"deposit-link-email",accessibilityLabel:`Open an email to ${e.name} with the deposit link`,onPress:()=>G(U)}):null,F?(0,g.jsx)(d.Button,{kind:"secondary",label:"Copy link",testID:"deposit-link-copy",accessibilityLabel:"Copy the deposit link",onPress:()=>{navigator.clipboard.writeText(L.url).catch(()=>{})}}):null]}),E||z||U?null:(0,g.jsx)(d.Muted,{children:"This booking has no phone number or email. Copy the link and send it another way."}),(0,g.jsx)(d.Muted,{size:13,children:"Tip: CoverCharge doesn't send anything. Each button opens your own messages app with the words filled in, and you press Send. Once the guest pays on website bookings, this booking shows Deposit paid on website bookings by itself. Refunds are done in Website bookings \u203a Orders."})]}):null,(0,g.jsx)(d.Button,{kind:"secondary",label:"Close",testID:"deposit-link-close",onPress:()=>j(!1)})]})})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=e(_r(_d[3]));_r(_d[4]);var l=e(_r(_d[5])),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),p=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),k=_r(_d[13]),g=_r(_d[14]);const y="Website bookings deposit links aren't switched on yet. Take the deposit by card or cash and tick Deposit paid.",w=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}):''},1434,[812,805,17,362,219,85,777,860,841,851,1001,928,804,1181,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:s,onPress:n,testID:b,a11y:y,disabled:f,accessibilityHint:h}){return(0,u.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:y??s,accessibilityHint:h,accessibilityState:{disabled:!!f},disabled:f,testID:b,onPress:n,style:({pressed:e})=>({...l.look.quiet(e),flexGrow:1,opacity:f?.4:1}),children:[e?(0,u.jsx)(o.T,{size:15,colour:c.colours.goldLight,children:e}):null,(0,u.jsx)(o.T,{size:15,weight:"semibold",colour:c.colours.goldLight,children:s})]})},r(d[0]);var e,s=r(d[1]),t=(e=s)&&e.__esModule?e:{default:e},l=r(d[2]),o=r(d[3]),c=r(d[4]),u=r(d[5])},1435,[17,385,1172,777,804,8]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1436,[17,85,864,858,848,804,777,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1437,[17,1395,1057,8]); +__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])},1438,[843,17,85,1162,777,858,845,853,863,804,1178,1057,8]); +__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)??(w.PITCH?'pitch':void 0),s=(0,p.useSync)(e=>w.PITCH?'live':e.mode),a=(0,p.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||w.PITCH,[l,r]=(0,n.useState)([]),[d,c]=(0,n.useState)('Reception screen'),[u,h]=(0,n.useState)(5),[y,j]=(0,n.useState)(!0),[S,_]=(0,n.useState)(null),[C,T]=(0,n.useState)(''),[P,I]=(0,n.useState)(!1),R=(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))),T('')}catch(e){T(String(e?.message??e))}},[e]);if((0,n.useEffect)(()=>{R()},[R]),!e||'signin'===s||'local'===s)return(0,f.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,f.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const D=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&&(I(!1),_({code:s.code,label:e.label,expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}},[B,M]=(0,n.useState)(null),[$,A]=(0,n.useState)(null),[N,F]=(0,n.useState)(!1),E=async e=>{try{await(0,p.rpc)('revoke_unused_display_codes',{p_token_id:e.id}),_(null),A(null),R()}catch(e){T(String(e?.message??e))}},U=async e=>{try{await(0,p.rpc)('revoke_display',{p_token_id:e.id}),R()}catch(e){T(String(e?.message??e))}};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"displays-page",children:[(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,f.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,f.jsx)(i.Field,{label:"Name",value:d,onChangeText:c,placeholder:"Reception screen"}),(0,f.jsx)(i.T,{size:14,children:"Code lasts"}),(0,f.jsx)(i.Row,{wrap:!0,gap:6,children:[5,30,0].map(e=>(0,f.jsx)(i.Chip,{label:0===e?'Forever':1===e?'1 day':`${e} days`,selected:u===e,onPress:()=>h(e)},e))}),(0,f.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:j}),(0,f.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:y}))?.[0];s&&(I(!1),_({code:s.code,label:d.trim()||'Reception screen',expires:s.expires_at})),R()}catch(e){T(String(e?.message??e))}}}),S?(0,f.jsxs)(o.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:x.colours.gold},children:[(0,f.jsxs)(i.T,{size:13,colour:x.colours.muted,children:[S.label," \xb7 ",'infinity'!==S.expires&&S.expires?`until ${k(S.expires)}`:'Forever (until used or revoked)']}),(0,f.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:S.code.replace(/(.{5})/,'$1 ')}),(0,f.jsx)(i.Button,{kind:"secondary",label:P?"Pairing link copied":"Copy pairing link",onPress:async()=>{const e=await(0,t.copyText)(b(S.code));I(e),e||T('Copy is not available on this device. Use the pairing code shown above.')}}),(0,f.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),C?(0,f.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:C}):null,(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:R})]}),0===l.length?(0,f.jsx)(i.Muted,{children:"No displays yet."}):l.filter(e=>N||!e.revoked_at).map(e=>(0,f.jsxs)(o.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:4},children:[(0,f.jsxs)(o.default,{style:{gap:4},children:[(0,f.jsx)(i.T,{center:!0,weight:"semibold",children:e.label.replace(/\s*\(pilot\)\s*$/i,'')}),(0,f.jsx)(i.T,{center:!0,size:13,colour:e.revoked_at?x.colours.red:e.sessions?x.colours.ok:x.colours.muted,children:e.revoked_at?`Switched off ${k(e.revoked_at)}`:e.sessions?'Paired':e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,f.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?$===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(i.T,{center:!0,children:["Revoke unused codes for \u201c",e.label,"\u201d? Already paired screens stay connected."]}),(0,f.jsxs)(i.Row,{wrap:!0,children:[(0,f.jsx)(i.Button,{kind:"danger",label:"Revoke unused codes",onPress:()=>{E(e)}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Keep codes",onPress:()=>A(null)})]})]}):(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Revoke unused codes\u2026",onPress:()=>A(e.id)}):null,e.revoked_at?null:B===e.id?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.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,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{M(null),U(e)}}),(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>M(null)})]})]}):(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>D(e)}),(0,f.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>M(e.id)})]})]},e.id)),l.some(e=>!!e.revoked_at)?(0,f.jsx)(i.Button,{small:!0,kind:"ghost",label:N?"Hide switched-off displays":"Show switched-off displays",onPress:()=>F(!N)}):null,(0,f.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."})]}),(0,f.jsx)(v,{})]})},_e.DeviceSyncCard=v,_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,y]=(0,n.useState)(null),w=!(0,p.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,p.can)('stock.manage');return(0,f.jsxs)(o.default,{style:{gap:10},testID:"tracked-stock",children:[(0,f.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,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),w?(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,f.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,f.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(S())}):null,r?(0,f.jsxs)(i.Card,{highlight:x.colours.gold,children:[(0,f.jsx)(i.T,{weight:"semibold",children:r.key?`Edit ${r.name}`:'New tracked item'}),(0,f.jsx)(i.Field,{label:"Name",value:r.name,onChangeText:e=>y({...r,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,f.jsx)(i.Field,{label:"Plural (optional)",value:r.plural,onChangeText:e=>y({...r,plural:e}),placeholder:"e.g. Oysters"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"Whole units",selected:'whole'===r.unit,onPress:()=>y({...r,unit:'whole'})}),'roast'===r.group?null:(0,f.jsx)(i.Chip,{label:"Halves too",selected:'half'===r.unit,onPress:()=>y({...r,unit:'half'})}),'roast'!==r.group&&(0,e.isAnchorage)(t)&&(0,s.isFishName)(r.name)?(0,f.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===r.unit,onPress:()=>y({...r,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,f.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;y({...r,lowAt:'kg'===r.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,f.jsx)(i.Field,{label:"Icon (an emoji)",value:r.icon,onChangeText:e=>y({...r,icon:e.slice(0,4)})}),(0,f.jsx)(i.T,{size:14,children:"Supplier"}),(0,f.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(i.Chip,{label:"None",selected:!r.supplierId,onPress:()=>y({...r,supplierId:void 0})}),l.map(e=>(0,f.jsx)(i.Chip,{label:e.name,selected:r.supplierId===e.id,onPress:()=>y({...r,supplierId:e.id})},e.id))]}),(0,f.jsx)(i.Toggle,{label:"Show the counter",value:r.active,onChange:e=>y({...r,active:e})}),(0,f.jsx)(i.Toggle,{label:"Sunday roast (Display, Sundays only, whole numbers)",testID:"stock-roast",value:'roast'===r.group,onChange:e=>y(e?{...r,group:'roast',unit:'whole'}:(({group:e,...s})=>s)(r))}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.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)}),y(null))}}),(0,f.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,f.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,j.validGameUrl)(a);return(0,f.jsxs)(o.default,{style:{gap:10},children:[(0,f.jsx)(i.Card,{children:(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,f.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,f.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>r.useStore.getState().updateSettings(e,{games:s})})]})}),(0,f.jsxs)(i.Card,{children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,f.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 (",j.LENNY_GAME_URL,")."]}),(0,f.jsx)(i.Field,{testID:"game-url",label:"Game address",value:a,onChangeText:l,autoCapitalize:"none",autoCorrect:!1,placeholder:j.LENNY_GAME_URL}),c?null:(0,f.jsx)(i.T,{size:13,colour:x.colours.red,children:"Use a full https:// address."}),(0,f.jsxs)(i.Row,{gap:6,children:[(0,f.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||a.trim()===t,onPress:()=>r.useStore.getState().updateSettings(e,{gameUrl:a.trim()?(0,j.validGameUrl)(a):void 0})}),t?(0,f.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]),f=_r(_d[17]);const k=e=>'infinity'===e?'Forever':e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;function v(){const[e,s]=(0,n.useState)([]),[t,a]=(0,n.useState)(''),[l,r]=(0,n.useState)(Date.now()),d=(0,n.useCallback)(async()=>{try{s(await(0,p.readSyncHeartbeats)()),a('')}catch(e){a(String(e?.message??e))}r(Date.now())},[]);return(0,n.useEffect)(()=>{d();const e=setInterval(()=>{d()},3e4);return()=>clearInterval(e)},[d]),(0,f.jsxs)(i.Card,{children:[(0,f.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(i.T,{weight:"semibold",children:"Device sync"}),(0,f.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",testID:"device-sync-refresh",onPress:d})]}),(0,f.jsx)(i.Muted,{children:"Every Managers, Staff, Chef, Display and car app reports once a minute when it last heard from the shared system. Red means that device is out of sync or has not reported for over 3 minutes (switched off, asleep or no signal)."}),t?(0,f.jsx)(i.Muted,{children:`Couldn\u2019t read device sync: ${t}`}):null,t||0!==e.length?null:(0,f.jsx)(i.Muted,{children:"No device has reported yet. Devices report once they are on v0.3.12.131 or later."}),e.map(e=>{const s=(0,y.deviceSyncLine)(e,l);return(0,f.jsxs)(o.default,{testID:`device-sync-${e.app}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:x.colours.border,gap:2},children:[(0,f.jsxs)(i.Row,{gap:8,style:{alignItems:'center'},children:[(0,f.jsx)(o.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:s.ok?x.colours.ok:x.colours.red}}),(0,f.jsx)(i.T,{weight:"semibold",children:s.title})]}),(0,f.jsx)(i.T,{size:13,colour:s.ok?x.colours.text:x.colours.red,children:s.state}),(0,f.jsx)(i.Muted,{children:s.detail})]},`${e.app}-${e.device_id}`)})]})}const S=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1439,[820,896,1440,17,219,85,777,816,876,895,1000,897,899,1446,804,880,1163,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Insights=function({go:e}){const{rid:t,r:s,now:l,today:n}=(0,v.useCtx)(6e4),i=(0,j.useBookings)(t),a=(0,j.useOrders)(t),r=(0,j.useEvents)(t),o=(0,j.useRatings)(t),c=(0,T.seatedCoversOn)(i,n),u=(0,T.laterTodayCovers)(i,n),h=(0,d.useMemo)(()=>(0,B.insights)(s,i,a,r,o,l,c),[s.id,i.length,a.length,o.length,c,u]);return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Muted,{children:(0,D.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.'}),h.map((t,s)=>(0,H.jsx)(I.FadeIn,{delay:80*s,children:(0,H.jsxs)(x.Card,{highlight:F[t.tone],children:[(0,H.jsxs)(x.Row,{style:{alignItems:'flex-start'},children:[(0,H.jsx)(x.T,{size:22,children:t.icon}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:t.body})]})]}),t.action?(0,H.jsx)(x.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,D.useExamples)()?(0,H.jsx)(U,{}):(0,H.jsx)(_,{})},_e.MenuEngineering=function(){const{rid:e,me:t}=(0,v.useCtx)(6e4),l=(0,D.useExamples)(),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,B.dishStats)(i),r=a.reduce((e,t)=>e+t.sold,0)/Math.max(1,a.length),o=a.reduce((e,t)=>e+t.margin,0)/Math.max(1,a.length),d={Star:k.colours.ok,'Plough horse':k.colours.amber,Puzzle:k.colours.blue,Dog:k.colours.red},c=a.map(e=>({...e,q:(0,B.quadrant)(e.sold,e.margin,r,o)}));return l?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example sales & food costs",children:"Margins use example food-cost percentages. Add your real costs in production."}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Margin vs popularity"}),(0,H.jsx)(I.Scatter,{width:Math.min(n,900)-60,points:c.map(e=>({x:e.sold,y:e.margin/100,colour:d[e.q],label:e.item.name.split(' ')[0]})),xMid:r,yMid:o/100}),(0,H.jsx)(x.Row,{wrap:!0,gap:8,children:Object.keys(d).map(e=>(0,H.jsxs)(x.Row,{gap:4,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:d[e]}}),(0,H.jsx)(x.Muted,{children:e})]},e))}),(0,H.jsx)(x.Muted,{children:"Across: sold (28 days). Up: \xa3 margin per dish."})]}),['Star','Plough horse','Puzzle','Dog'].map(e=>{const t=c.filter(t=>t.q===e);return t.length?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.Row,{style:{justifyContent:'space-between'},children:(0,H.jsxs)(x.T,{weight:"semibold",colour:d[e],children:[e,"s (",t.length,")"]})}),(0,H.jsx)(x.Muted,{children:B.QUADRANT_TIP[e]}),t.map(e=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.item.name}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",Math.round(100*e.costPct),"% cost \xb7 ",(0,f.gbp)(e.margin)]}),(0,H.jsx)(h.default,{accessibilityRole:"button",accessibilityLabel:e.item.soldOut?`Back on: ${e.item.name}`:`Mark sold out: ${e.item.name}`,onPress:()=>((0,s.setSoldOut)(e.item.id,!e.item.soldOut),(0,$.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?k.colours.amber:k.colours.border},children:(0,H.jsx)(x.T,{size:11,colour:e.item.soldOut?k.colours.amber:k.colours.muted,children:e.item.soldOut?'Sold out':'Mark sold out'})})]},e.item.id))]},e):null}),(0,H.jsxs)(x.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,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"menu-eng-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"Not enough data yet"}),(0,H.jsx)(x.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:s,now:n,me:i,today:a}=(0,v.useCtx)(6e4),r=(0,y.useOwner)(e=>e.suppliers),o=(0,j.useBookings)(t),c=(0,j.useOrders)(t),u=(0,j.useEvents)(t),h=(0,y.useOwner)(e=>e.checks),m=(0,P.useRealHistory)(t,n),p=(0,d.useMemo)(()=>(0,l.forecastToday)(s,o,c,u,n,m??void 0),[s.id,o.length,c.length,n.getHours(),m]),b=p.restOfDay.high+2*p.restOfDay.takeaway,f=(0,B.stockList)();return(0,H.jsxs)(g.default,{style:{gap:10},children:[p.enough?(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Rest of today: about ",(0,l.coversRange)(p.restOfDay.low,p.restOfDay.high)," + about ",p.restOfDay.takeaway," takeaways"]}),(0,H.jsx)(x.Muted,{children:p.example?'Example figures. Prep uses the high end of the forecast. Stock levels are examples.':'Prep uses the high end of the forecast.'})]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:p.minWeeks,booked:p.hours.reduce((e,t)=>e+t.booked,0),what:"Prep forecasts",testID:"prep-not-enough"}),f.length?null:(0,H.jsx)(x.Card,{children:(0,H.jsx)(x.Muted,{children:"No stock levels yet. CoverCharge doesn't track stock on a real venue yet, so no shortfalls are guessed."})}),f.map(t=>{const s=Math.ceil(b*t.perCover*10)/10,l=s>t.onHand,o=(0,R.supplierForCat)(r,t.cat),d=`${a}:prep:${t.id}`,c=h[d];return(0,H.jsxs)(g.default,{style:[x.styles.card,{borderColor:l?k.colours.red:k.colours.border}],children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsx)(x.Badge,{kind:l?'red':'ok',label:l?`Short ${Math.ceil(10*(s-t.onHand))/10} ${t.unit}`:'OK'})]}),(0,H.jsxs)(x.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,H.jsxs)(x.Muted,{children:["Supplier: ",o.name," \xb7 ",o.phones[0],o.cutoff?` \xb7 order by ${o.cutoff}`:'']}):null,l&&o?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:`Order from ${o.name}`,onPress:()=>e('more','suppliers')}):null,(0,H.jsx)(x.Chip,{label:c?`Prepped \u2713 ${c.by.split(' ')[0]} ${c.at}`:'Mark prepped',selected:!!c,onPress:()=>c?y.useOwner.getState().untick(d):y.useOwner.getState().tick(d,i,(0,w.hm)(n))})]},t.id)})]})},_e.Crm=function(){const e=(0,y.useOwner)(e=>e.customerTags),[s,l]=(0,d.useState)(''),[n,i]=(0,d.useState)('All'),[a,r]=(0,d.useState)(null),o=(0,d.useMemo)(()=>(0,B.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=o.filter(c[n]).filter(e=>!s||e.name.toLowerCase().includes(s.toLowerCase())),h=o.find(e=>e.id===a);return o.length?(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Search customers",placeholder:"Search customers",placeholderTextColor:"#7D776C",value:s,onChangeText:l,style:x.styles.input}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(c).map(e=>(0,H.jsx)(x.Chip,{label:`${e} (${o.filter(c[e]).length})`,selected:n===e,onPress:()=>i(e)},e))}),u.map(t=>(0,H.jsxs)(x.Card,{onPress:()=>r(t.id),children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.name}),(0,H.jsxs)(x.Muted,{children:[t.visits," visits"]})]}),(0,H.jsxs)(x.Muted,{children:["Last ",t.lastVisit," \xb7 ",(0,f.gbp)(t.spend)," lifetime \xb7 ",t.stamps," stamps",t.optIn?' \xb7 opted in':'']}),t.allergies.length||(e[t.id]??[]).length?(0,H.jsxs)(x.Row,{wrap:!0,gap:4,children:[t.allergies.map(e=>(0,H.jsx)(x.Badge,{kind:"red",label:e},e)),(e[t.id]??[]).map(e=>(0,H.jsx)(x.Badge,{kind:"gold",label:e},e))]}):null]},t.id)),(0,H.jsx)(x.Muted,{children:"Customer records come from your saved data. Marketing requires consent (UK GDPR / PECR)."}),h?(0,H.jsxs)(x.Sheet,{visible:!0,onClose:()=>r(null),title:h.name,children:[(0,H.jsxs)(x.Muted,{children:[h.phone," \xb7 ",h.visits," visits \xb7 last ",h.lastVisit," \xb7 prefers ",h.channel]}),(0,H.jsxs)(x.T,{children:["Lifetime spend ",(0,f.gbp)(h.spend)," \xb7 stamps ",h.stamps]}),h.allergies.length?(0,H.jsx)(x.Banner,{kind:"danger",title:"Allergies on file",children:h.allergies.join(', ')}):(0,H.jsx)(x.Muted,{children:"No allergies on file."}),h.birthday?(0,H.jsxs)(x.Muted,{children:["Birthday: ",h.birthday]}):null,(0,H.jsx)(x.Badge,{kind:h.optIn?'ok':'neutral',label:h.optIn?'Opted in to offers':'Not opted in: no marketing'}),(0,H.jsx)(x.T,{weight:"semibold",children:"Tags"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:q.map(t=>(0,H.jsx)(x.Chip,{label:t,selected:(e[h.id]??[]).includes(t),onPress:()=>y.useOwner.getState().toggleTag(h.id,t)},t))})]}):null]}):(0,H.jsx)(x.Card,{children:(0,H.jsxs)(g.default,{testID:"crm-live",style:{gap:6},children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.gold,children:"No customer list yet"}),(0,H.jsx)(x.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,v.useCtx)(6e4),s=(0,y.useOwner)(e=>e.campaigns),l=(0,j.useStore)((0,p.useShallow)(e=>e.giftCards.filter(e=>e.restaurantId===t))),n=(0,j.useEvents)(t).filter(e=>e.restaurantId===t),i=(0,y.useOwner)(e=>e.marketingDraft),[a,r]=(0,d.useState)(i?.title??''),[o,c]=(0,d.useState)(i?.body??''),[u,h]=(0,d.useState)('All opted-in'),[m,b]=(0,d.useState)('Now'),k=(0,D.useExamples)(),S=k?{'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,H.jsxs)(g.default,{style:{gap:10},children:[i?(0,H.jsx)(x.Banner,{kind:"info",title:"Draft from the calendar",children:`"${i.title}" is ready in the composer below.`}):null,(0,H.jsx)(x.Banner,{kind:"info",title:"Campaign delivery is not connected",children:"Drafts stay on this device. No push, SMS or email is sent."}),(0,H.jsxs)(x.Row,{gap:8,children:[k?(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Referrals"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"27"}),(0,H.jsx)(x.Muted,{children:"sign-ups, 11 ordered (example)"})]}):null,(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Gift card sales"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:(0,f.gbp)(l.reduce((e,t)=>e+t.initial,0))}),(0,H.jsxs)(x.Muted,{children:[l.length," cards"]})]})]}),(0,H.jsx)(C.SectionHead,{title:"Post to social",sub:"Facebook + Instagram, TikTok + YouTube: not set up yet, nothing is posted"}),(0,H.jsx)(M.PostToSocialButtons,{onPick:t=>(0,M.shareToSocial)(e,{group:t})}),(0,H.jsx)(M.QuickLinksSection,{go:e,heading:e=>(0,H.jsx)(C.SectionHead,{title:e})}),(0,H.jsx)(C.SectionHead,{title:"Campaigns"}),s.map(e=>(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,H.jsx)(x.Badge,{kind:'scheduled'===e.status?'amber':'draft'===e.status?'neutral':'ok',label:e.status})]}),(0,H.jsx)(x.Muted,{children:e.body}),(0,H.jsxs)(x.Muted,{children:[e.segment,e.reach?` \xb7 ${e.reach} people`:''," \xb7 ",e.sendAt]}),'sent (demo)'!==e.status?(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>y.useOwner.getState().setCampaign(e.id,{status:'draft'})}):k?(0,H.jsx)(x.Muted,{children:"Opened 46% \xb7 23 orders (example)"}):null]},e.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"New campaign"}),(0,H.jsx)(x.Field,{label:"Title",value:a,onChangeText:r}),(0,H.jsx)(x.Field,{label:"Message",value:o,onChangeText:c,multiline:!0}),(0,H.jsx)(x.Muted,{children:"Audience"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:Object.keys(S).map(e=>(0,H.jsx)(x.Chip,{label:e,sub:null==S[e]?void 0:`${S[e]}`,selected:u===e,onPress:()=>h(e)},e))}),(0,H.jsx)(x.Muted,{children:"When"}),(0,H.jsx)(x.Row,{wrap:!0,gap:6,children:['Now','Tomorrow 10:00','Friday 15:00','Next Monday 11:00'].map(e=>(0,H.jsx)(x.Chip,{label:e,selected:m===e,onPress:()=>b(e)},e))}),(0,H.jsx)(x.Button,{label:'Now'===m?'Save (nothing is sent: not set up yet)':'Save for later (nothing is sent)',disabled:a.trim().length<3||o.trim().length<5,onPress:()=>{y.useOwner.getState().addCampaign({title:a.trim(),body:o.trim(),segment:u,sendAt:m,status:'draft',reach:S[u]??0}),y.useOwner.getState().setOwner({marketingDraft:void 0}),r(''),c('')}})]}),(0,H.jsx)(C.SectionHead,{title:"Event promos"}),n.map(t=>(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.title}),(0,H.jsx)(x.Muted,{children:(0,w.niceDate)((0,w.parseYmd)(t.date))}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Draft a promo",onPress:()=>{r(t.title.replace(' (example)','')),c(`Join us on ${(0,w.niceDate)((0,w.parseYmd)(t.date))} at ${(0,E.venueInfo)().name}. Book in the app.`)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Share to social",accessibilityLabel:`Share ${t.title} to social`,onPress:()=>(0,M.shareToSocial)(e,(0,M.eventDraft)(t))})]})]},t.id))]})},_e.Reviews=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsx)(b.ReviewsSection,{rid:e,mode:"manage",venueName:t.name})},_e.ReviewEmailSettings=function(){const{rid:e,r:t}=(0,v.useCtx)(6e4);return(0,H.jsxs)(g.default,{style:{gap:12},children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:"Ask guests for a review after their visit"}),(0,H.jsx)(x.Muted,{center:!0,children:"Off until you switch it on. Turning it on does not send an email from this screen."}),(0,H.jsx)(x.Card,{children:(0,H.jsx)(b.ReviewAskCard,{rid:e,venueName:t.name})})]})},_e.Compliance=function(){const{rid:e,now:s,me:l,today:n}=(0,v.useCtx)(3e4),i=(0,y.useOwner)(e=>e.checks),a=(0,j.useAudit)(e).filter(e=>'allergy'===e.kind||'menu'===e.kind).slice(0,15),[r,o]=(0,d.useState)({}),c=K.filter(e=>i[`${n}:${e.id}`]).length;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["Daily checklist \xb7 ",(0,w.niceDate)(s)]}),(0,H.jsx)(x.Badge,{kind:c===K.length?'ok':'amber',label:`${c}/${K.length}`})]}),(0,H.jsx)(g.default,{style:{height:8,backgroundColor:k.colours.border,borderRadius:4},children:(0,H.jsx)(g.default,{style:{height:8,width:c/K.length*100+"%",backgroundColor:k.colours.ok,borderRadius:4}})}),K.map(e=>{const a=`${n}:${e.id}`,d=i[a],c=Number(r[e.id]),u=null!=d?.value&&('freezer'===e.id?Number(d.value)>-18:'hot'===e.id?Number(d.value)<63:Number(d.value)>5);return(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{size:14,children:e.label}),d?(0,H.jsxs)(x.Muted,{children:[null!=d.value?`${d.value}\xb0C \xb7 `:'',d.by," ",d.at,u?' \xb7 OUT OF RANGE':'']}):null]}),e.temp&&!d?(0,H.jsx)(t.TextInput,{accessibilityLabel:`${e.label} \xb0C`,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",value:r[e.id]??'',onChangeText:t=>o({...r,[e.id]:t}),style:[x.styles.input,{width:64,paddingVertical:4}]}):null,(0,H.jsx)(x.Chip,{label:d?u?'\u26a0':'\u2713':'Tick',selected:!!d,disabled:!d&&e.temp&&!Number.isFinite(c),onPress:()=>d?y.useOwner.getState().untick(a):y.useOwner.getState().tick(a,l,(0,w.hm)(s),e.temp?String(c):void 0)})]},e.id)}),(0,H.jsx)(x.Muted,{children:"Fridges \u22645\xb0C, freezer \u2264\u221218\xb0C, hot-hold \u226563\xb0C (FSS guidance). Records are kept on this device for now."})]}),(0,H.jsx)(C.SectionHead,{title:"Allergen audit log",sub:"Sign-offs and overrides (full chains: More \u203a Allergen sign-off log)"}),a.length?a.map(e=>(0,H.jsxs)(x.Muted,{children:[(0,w.niceDate)(new Date(e.at))," ",(0,w.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,H.jsx)(x.Muted,{children:"No allergen events yet today."})]})},_e.LostProperty=function(){const{now:e,me:s}=(0,v.useCtx)(6e4),l=(0,y.useOwner)(e=>e.lost),n=(0,y.useOwner)(e=>e.lostReports),i=(0,y.useOwner)(e=>e.coats),[a,r]=(0,d.useState)(''),[o,c]=(0,d.useState)(''),[u,h]=(0,d.useState)(''),m=Math.max(0,...i.map(e=>e.ticket))+1;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(C.SectionHead,{title:`Coat check (${i.filter(e=>'in'===e.status).length} in)`}),i.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'collected'===e.status?.55:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{weight:"semibold",children:["#",e.ticket," \xb7 ",e.desc]}),(0,H.jsx)(x.Badge,{kind:'in'===e.status?'gold':'ok',label:'in'===e.status?`In since ${e.at}`:'Collected'})]}),'in'===e.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Collected",onPress:()=>y.useOwner.getState().setOwner({coats:i.map(t=>t.id===e.id?{...t,status:'collected'}:t)})}):null]},e.id)),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(t.TextInput,{accessibilityLabel:"Coat description",placeholder:`Ticket #${m}: describe item`,placeholderTextColor:"#7D776C",value:u,onChangeText:h,style:[x.styles.input,{flex:1}]}),(0,H.jsx)(x.Button,{small:!0,label:"Check in",disabled:u.trim().length<2,onPress:()=>{y.useOwner.getState().setOwner({coats:[...i,{id:`ct-${Date.now()}`,ticket:m,desc:u.trim(),at:(0,w.hm)(e),status:'in'}]}),h('')}})]}),n.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(C.SectionHead,{title:`Reports from guests (${n.filter(e=>'open'===e.status).length} open)`,sub:"Sent from the CoverCharge customer app"}),n.map(e=>(0,H.jsxs)(x.Card,{style:{opacity:'closed'===e.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:e.item}),(0,H.jsx)(x.Badge,{kind:'open'===e.status?'amber':'ok',label:'open'===e.status?'Open':'matched'===e.status?'Matched':'Closed'})]}),(0,H.jsxs)(x.Muted,{children:[e.when," \xb7 ",e.where," \xb7 contact: ",e.contact]}),'open'===e.status?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Found it",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'matched'}:t)})}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Close",onPress:()=>y.useOwner.getState().setOwner({lostReports:n.map(t=>t.id===e.id?{...t,status:'closed'}:t)})})]}):null]},e.id))]}):null,(0,H.jsx)(C.SectionHead,{title:"Lost property"}),0===l.length?(0,H.jsx)(x.Muted,{children:"Nothing logged yet."}):null,l.map(t=>(0,H.jsxs)(x.Card,{style:{opacity:'returned'===t.status?.6:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:"semibold",children:t.item}),(0,H.jsx)(x.Badge,{kind:'held'===t.status?'amber':'ok',label:'held'===t.status?'Held':'Returned'})]}),(0,H.jsxs)(x.Muted,{children:[t.where," \xb7 found ",W(t.foundAt)," by ",t.foundBy,t.contact?` \xb7 ${t.contact}`:'']}),'held'===t.status?(0,H.jsx)(x.Button,{small:!0,kind:"secondary",label:"Mark returned",onPress:()=>y.useOwner.getState().setLost(t.id,{status:'returned',contact:`Returned ${(0,w.niceDate)(e)} by ${s}`})}):null]},t.id)),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Log a found item"}),(0,H.jsx)(x.Field,{label:"Item",value:a,onChangeText:r,placeholder:"e.g. Black phone"}),(0,H.jsx)(x.Field,{label:"Where",value:o,onChangeText:c,placeholder:"e.g. 7"}),(0,H.jsx)(x.Button,{label:"Add",disabled:a.trim().length<2,onPress:()=>{y.useOwner.getState().addLost({item:a.trim(),where:o.trim()||'Not noted',foundAt:`${e.toISOString().slice(0,10)} ${(0,w.hm)(e)}`,foundBy:s}),r(''),c('')}})]})]})},_e.useNotifications=V,_e.Notifications=function({go:e}){const{rid:t,meId:s}=(0,v.useCtx)(3e4),{list:l,read:n}=V(),[m,p]=(0,d.useState)('all'),b=(0,o.useAlerts)(e=>e.history),f=(0,o.useAlerts)(e=>e.read),w=(0,o.useAlerts)(e=>e.readAllAt[t]??0),C=e=>(0,o.isUnread)({read:f,readAllAt:{[t]:w}},e),[S,T]=(0,d.useState)(''),M=(0,o.useAlerts)(e=>e.cleared),[$,R]=(0,d.useState)(!1),[O,B]=(0,d.useState)({}),[D,P]=(0,d.useState)(null),A=b.filter(e=>e.rid===t&&!(0,o.isCleared)({cleared:M},e)),N=A.filter(e=>'all'===m||e.kind===m),L=(0,j.useBookings)(t).filter(e=>'pending'===e.status).length;c.default.useEffect(()=>{(0,o.markNotificationsSeen)(t,l.map(e=>e.id))},[t,A.length,l.length]);const I=t=>{o.useAlerts.getState().markRead([t.id]),'takeaway'===t.kind?e('orders'):'booking'!==t.kind&&'pending'!==t.kind||e('bookings')};return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.T,{weight:"semibold",center:!0,accessibilityRole:"header",children:"Alerts"}),(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Mark all read",testID:"alerts-mark-all",style:{minHeight:44},accessibilityLabel:"Mark all alerts as read",onPress:async()=>{y.useOwner.getState().markRead(l.map(e=>e.id));const e=await(0,o.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'})})`),u.default.announceForAccessibility?.(e)}}),(0,H.jsx)(x.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,H.jsx)(x.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 ${G.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,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Settings",onPress:()=>e('more','alerts'),style:{minHeight:44}})]}),$?(0,H.jsx)(g.default,{testID:"alerts-select-bar",children:(0,H.jsxs)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:[(0,H.jsx)(x.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,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-clear-confirm",children:(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{center:!0,weight:"semibold",accessibilityRole:"header",children:`Clear ${Object.keys(D.ids).length} ${1===Object.keys(D.ids).length?'alert':'alerts'}?`}),(0,H.jsx)(x.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,H.jsxs)(x.Row,{gap:8,style:{justifyContent:'center',marginTop:8},children:[(0,H.jsx)(x.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,o.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),u.default.announceForAccessibility?.(s)},style:{minHeight:44,minWidth:110}}),(0,H.jsx)(x.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,H.jsx)(g.default,{testID:"alerts-mark-all-done",accessibilityLiveRegion:"polite",children:(0,H.jsx)(x.Muted,{children:S})}):null,L?(0,H.jsxs)(x.Banner,{kind:"warn",children:[L," booking ",1===L?'request needs':'requests need'," confirming. We\u2019ll keep reminding you every few minutes until ",1===L?'it\u2019s':'they\u2019re'," handled."]}):null,(0,H.jsx)(x.Row,{wrap:!0,gap:6,style:{justifyContent:'center',width:'100%'},children:G.map(e=>{const t='all'===e.id?A.filter(C).length:(s=e.id,A.filter(e=>e.kind===s&&C(e)).length);var s;return(0,H.jsxs)(h.default,{testID:`alert-filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:m===e.id},accessibilityLabel:`Show ${e.label}${t?`, ${t} new`:''}`,onPress:()=>{p(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?k.colours.gold:o.KIND_META[e.id].colour:k.colours.border,backgroundColor:m===e.id?'#1d1a14':'transparent'},children:['all'!==e.id?(0,H.jsx)(r.KindIcon,{kind:e.id,size:15}):null,(0,H.jsx)(x.T,{size:13,colour:m===e.id?k.colours.text:k.colours.muted,children:e.label}),t?(0,H.jsx)(g.default,{style:{minWidth:16,height:16,borderRadius:8,paddingHorizontal:4,backgroundColor:'all'===e.id?k.colours.gold:o.KIND_META[e.id].colour,alignItems:'center',justifyContent:'center'},children:(0,H.jsx)(x.T,{size:10,weight:"bold",colour:"#0B0B0B",children:t})}):null]},e.id)})}),'email'!==m||o.CONNECTED_INBOX?null:(0,H.jsx)(x.Card,{children:(0,H.jsxs)(x.Row,{gap:10,children:[(0,H.jsx)(r.KindIcon,{kind:"email"}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsx)(x.T,{weight:"semibold",children:o.INBOX_EMPTY}),(0,H.jsx)(x.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=o.KIND_META[e.kind],s=C(e);return(0,H.jsx)(x.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}):I(e),children:(0,H.jsxs)(x.Row,{gap:10,children:[$?(0,H.jsx)(h.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,o.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,H.jsx)(g.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:k.colours.gold,backgroundColor:void 0!==O[e.id]?k.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:void 0!==O[e.id]?(0,H.jsx)(a.default,{width:16,height:16,viewBox:"0 0 24 24",children:(0,H.jsx)(i.Path,{d:"M5 12.5l4.5 4.5L19 7.5",stroke:"#0B0B0B",strokeWidth:3,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}):null})}):null,(0,H.jsx)(r.KindChip,{kind:e.kind,size:34}),(0,H.jsxs)(g.default,{style:{flex:1},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:11,weight:"bold",colour:t.colour,style:{letterSpacing:1.6},children:[t.kicker,e.test?' \xb7 TEST':'']}),(0,H.jsx)(x.Muted,{children:Y(e.at)})]}),(0,H.jsx)(x.T,{weight:s?'semibold':'regular',children:(0,o.alertText)(e).title.replace(/^[^:]*:\s*/,'')}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:(0,o.alertText)(e).body})]}),s?(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.colour}}):null]})},e.id+e.at)}),N.length||'email'===m&&!o.CONNECTED_INBOX?null:(0,H.jsx)(x.Muted,{children:"No alerts here yet. New bookings, requests and takeaway orders will appear as they come in."}),(0,H.jsx)(x.T,{weight:"semibold",style:{marginTop:8},children:"To do"}),l.map(t=>(0,H.jsxs)(x.Card,{highlight:n[t.id]?void 0:t.tone,onPress:()=>{y.useOwner.getState().markRead([t.id]);const[s,l]=t.tab.split(':');e(s,l??null)},children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{weight:n[t.id]?'regular':'semibold',style:{flex:1},children:t.title}),n[t.id]?null:(0,H.jsx)(g.default,{style:{width:8,height:8,borderRadius:4,backgroundColor:t.tone}})]}),(0,H.jsx)(x.Muted,{numberOfLines:2,children:t.body})]},t.id)),l.length?null:(0,H.jsx)(x.Muted,{children:"All caught up."})]})},_e.Search=function({go:e}){const{rid:s,role:l}=(0,v.useCtx)(6e4),[n,i]=(0,d.useState)(''),a=(0,j.useAllMenu)(s),r=(0,j.useOrders)(s),o=(0,j.useBookings)(s),c=(0,y.useOwner)(e=>e.staff),u=(0,d.useMemo)(()=>(0,B.crmCustomers)(),[]),h=n.trim().toLowerCase(),m=h.length<2?[]:[...O.PAGES.filter(e=>'Retired'!==e.group&&(!e.can||e.can(l))&&(e.title+e.sub).toLowerCase().includes(h)).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(h)).map(t=>({k:t.id,kind:'Dish',t:t.name,sub:`${null!=t.price?(0,f.gbp)(t.price):'Board'}${t.soldOut?' \xb7 sold out':''}`,on:()=>e('more','menu')})),...r.filter(e=>(e.ref+e.customerName).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Order',t:`${t.ref} ${t.customerName}`,sub:t.status,on:()=>e('orders')})),...o.filter(e=>(e.name+e.ref).toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Booking',t:`${t.name} \xb7 ${t.partySize}`,sub:`${t.date} ${t.time}`,on:()=>e('bookings')})),...y.CAN.manage(l)?u.filter(e=>e.name.toLowerCase().includes(h)).map(t=>({k:t.id,kind:'Customer',t:t.name,sub:`${t.visits} visits`,on:()=>e('more','crm')})):[],...c.filter(e=>(0,y.staffMatches)(e,h)).map(t=>({k:t.id,kind:'Staff',t:(0,y.staffLabel)(t),sub:t.job,on:()=>e('more','staff')}))].slice(0,30);return(0,H.jsxs)(g.default,{style:{gap:8},children:[(0,H.jsx)(t.TextInput,{autoFocus:!0,accessibilityLabel:"Search everything",placeholder:"Search dishes, orders, bookings, customers, staff, screens",placeholderTextColor:"#7D776C",value:n,onChangeText:i,style:x.styles.input}),m.map(e=>(0,H.jsxs)(x.Card,{onPress:e.on,children:[(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsx)(x.T,{style:{flex:1},children:e.t}),(0,H.jsx)(x.Badge,{kind:"neutral",label:e.kind})]}),(0,H.jsx)(x.Muted,{children:e.sub})]},e.k)),h.length>=2&&!m.length?(0,H.jsx)(x.Muted,{children:"No matches."}):null,h.length<2?(0,H.jsx)(x.Muted,{children:"Try \u201chaddock\u201d, \u201cReid\u201d, \u201crota\u201d or \u201cT-10\u201d."}):null]})},_e.DemoTools=function(){(0,j.useStore)(e=>e.clock.mode);const[e,t]=(0,d.useState)(!1);return(0,n.useSync)(e=>!!e.venueId&&e.kind!=='guest')?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Live venue"}),(0,H.jsx)(x.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,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsxs)(x.Card,{children:[null,(0,H.jsx)(x.Muted,{children:"On: the example data shows a busy Friday evening. Off: real time."})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Reset example data"}),e?(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Button,{small:!0,kind:"danger",label:"Yes, reset this device",onPress:()=>{j.useStore.getState().resetDemo(),y.useOwner.getState().resetOwner(),t(!1)}}),(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>t(!1)})]}):(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:"Reset all example data\u2026",onPress:()=>t(!0)}),(0,H.jsx)(x.Muted,{children:"Only affects example data stored on this phone."})]})]})},_e.appUrl=X,_e.copyText=J,_e.YourApps=function(){const[e,s]=(0,d.useState)(null);return(0,H.jsxs)(g.default,{style:{gap:8},testID:"your-apps",children:[(0,H.jsx)(x.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."}),Q.map(l=>{const n={...l,name:(0,E.venueInfo)().name+l.name},i=X(n.path);return(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:n.name}),(0,H.jsx)(x.Muted,{children:n.who}),(0,H.jsx)(x.Row,{gap:10,children:(0,H.jsxs)(t.Text,{role:"link",href:i,hrefAttrs:{target:'_blank',rel:'noopener noreferrer'},onPress:void 0,style:{fontFamily:k.fonts.medium,fontSize:14,lineHeight:20,color:k.colours.gold,textDecorationLine:'underline',flexShrink:1},children:["Open ",n.name," \u2197"]})}),(0,H.jsx)(x.Row,{gap:6,children:(0,H.jsx)(x.Button,{small:!0,kind:"ghost",label:e===n.path?'Copied \u2713':'Copy link',onPress:async()=>{const e=await J(X(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=_r(_d[4]),a=e(i),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=e(d),u=e(_r(_d[8]));_r(_d[9]),_r(_d[10]);var h=e(_r(_d[11])),g=e(_r(_d[12])),m=e(_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]),L=_r(_d[35]),I=_r(_d[36]),E=_r(_d[37]),H=_r(_d[38]);const z={'Dine-in':k.colours.gold,Takeaway:k.colours.blue,'Table QR':k.colours.ok},F={gold:k.colours.gold,red:k.colours.red,amber:k.colours.amber,ok:k.colours.ok,blue:k.colours.blue},W=e=>{const t=/^(\d{4})-(\d{2})-(\d{2})(.*)$/.exec(e);return t?`${t[3]}/${t[2]}/${t[1]}${t[4]}`:e};function _(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useBookings)(e),a=(0,A.useCashUp)(e=>e.cashUps),[r,o]=(0,d.useState)(28),c=Math.min(n,900)-60,u=(0,w.ymd)(new Date(s.getTime()-864e5*r)),h=a.filter(t=>t.rid===e&&t.date>=u&&t.date({date:e.date,t:(0,N.takings)(e.vals)})).filter(e=>'number'==typeof e.t).sort((e,t)=>e.date.localeCompare(t.date)),p=h.reduce((e,t)=>e+t.t,0),b=i.filter(e=>e.date>=u&&e.date'noshow'===e.status).length,f=(0,L.clampWeeks)(t.settings.forecastMinWeeks);return(0,H.jsxs)(g.default,{style:{gap:10},testID:"analytics-live",children:[(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),h.length?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["Takings from your cash-ups (",h.length," day",1===h.length?'':'s',")"]}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:["\xa3",Math.round(p).toLocaleString('en-GB')]})]}),h.length>1?(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily takings (cash-ups)"}),(0,H.jsx)(I.LineChart,{width:c,series:[h.map(e=>e.t)],labels:h.map(e=>(0,w.niceDate)((0,w.parseYmd)(e.date)).slice(0,6))})]}):null]}):(0,H.jsx)(P.NotEnoughHistory,{weeks:f,what:"Sales figures",testID:"analytics-not-enough"}),(0,H.jsxs)(x.Card,{children:[(0,H.jsxs)(x.Muted,{children:["No-show rate (",r," days)"]}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:b.length?Math.round(y/b.length*1e3)/10+"%":'\u2014'}),(0,H.jsx)(x.Muted,{children:b.length?`${y} of ${b.length} bookings`:'No past bookings yet'})]}),(0,H.jsx)(x.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 U(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(6e4),{width:n}=(0,m.default)(),i=(0,j.useAllMenu)(e),a=(0,j.useBookings)(e),[r,o]=(0,d.useState)(28),c=(0,d.useMemo)(()=>(0,B.revenueHistory)(t,s,r),[t.id,r,s.toDateString()]),u=c.reduce((e,t)=>e+t.total,0),h=c.reduce((e,t)=>e+t.covers,0),p=B.CHANNELS.map(e=>({c:e,v:c.reduce((t,s)=>t+s.byChannel[e],0)})),b=(0,B.dishStats)(i).sort((e,t)=>t.sold-e.sold).slice(0,5),y=p.find(e=>'Takeaway'===e.c).v+p.find(e=>'Table QR'===e.c).v,w=Math.min(n,900)-60;return(0,H.jsxs)(g.default,{style:{gap:10},children:[(0,H.jsx)(x.Banner,{kind:"example",title:"Example figures",children:"Sales history is invented for the demo. In production it comes from your orders and till."}),(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(x.Chip,{label:"7 days",selected:7===r,onPress:()=>o(7)}),(0,H.jsx)(x.Chip,{label:"28 days",selected:28===r,onPress:()=>o(28)})]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Revenue"}),(0,H.jsx)(I.CountUp,{value:u/100,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:20})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Avg spend per Cover"}),(0,H.jsx)(I.CountUp,{value:h?u/h/100:0,format:e=>`\xa3${e.toFixed(2)}`,size:20})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Daily revenue"}),(0,H.jsx)(I.LineChart,{width:w,series:[c.map(e=>e.total/100)],labels:c.map(e=>e.label)})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Revenue by channel"}),(0,H.jsxs)(x.Row,{gap:14,children:[(0,H.jsx)(I.Donut,{parts:p.map(e=>({value:e.v,colour:z[e.c]})),centre:`\xa3${Math.round(u/1e5)}k`}),(0,H.jsx)(g.default,{style:{gap:4,flex:1},children:p.map(e=>(0,H.jsxs)(x.Row,{gap:6,children:[(0,H.jsx)(g.default,{style:{width:10,height:10,borderRadius:5,backgroundColor:z[e.c]}}),(0,H.jsx)(x.T,{size:14,style:{flex:1},children:e.c}),(0,H.jsxs)(x.T,{size:14,children:[Math.round(e.v/u*100),"%"]})]},e.c))})]})]}),(0,H.jsxs)(x.Card,{children:[(0,H.jsx)(x.T,{weight:"semibold",children:"Top dishes"}),b.map((e,t)=>(0,H.jsxs)(x.Row,{style:{justifyContent:'space-between'},children:[(0,H.jsxs)(x.T,{size:14,style:{flex:1},children:[t+1,". ",e.item.name]}),(0,H.jsxs)(x.Muted,{children:[e.sold," sold \xb7 ",(0,f.gbp)(e.revenue)]})]},e.item.id))]}),(0,H.jsxs)(x.Row,{gap:8,children:[(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"Repeat customers"}),(0,H.jsx)(x.T,{size:20,weight:"bold",children:"38%"}),(0,H.jsx)(x.Muted,{children:"2+ visits in 90 days (example)"})]}),(0,H.jsxs)(x.Card,{style:{flex:1},children:[(0,H.jsx)(x.Muted,{children:"No-show rate"}),(0,H.jsxs)(x.T,{size:20,weight:"bold",children:[4.1,"%"]}),(0,H.jsxs)(x.Muted,{children:[a.filter(e=>e.date===l&&'noshow'===e.status).length," today"]})]})]}),(0,H.jsxs)(x.Card,{highlight:k.colours.ok,children:[(0,H.jsx)(x.T,{weight:"semibold",colour:k.colours.ok,children:"Commission saved vs delivery apps"}),(0,H.jsx)(I.CountUp,{value:.3*y/100*1,format:e=>`\xa3${Math.round(e).toLocaleString('en-GB')}`,size:26,colour:k.colours.ok}),(0,H.jsxs)(x.Muted,{children:[(0,f.gbp)(y)," of direct takeaway & QR orders in ",r," days. At a typical 30% delivery-app commission, that\u2019s what you kept."]})]})]})}const q=['Regular','VIP','Local','Tourist','Birthday soon','Allergy'];const K=[{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 V(){const{rid:e,r:t,now:s,today:l}=(0,v.useCtx)(1e4),n=(0,j.useOrders)(e),i=(0,j.useBookings)(e),a=(0,j.useRatings)(e),r=(0,j.useWaitlist)(e),o=(0,y.useOwner)(e=>e.leave),d=(0,y.useOwner)(e=>e.swaps),c=(0,y.useOwner)(e=>e.readNotes),u=[...n.filter(e=>(0,C.LIVE)(e)&&'new'===e.status).map(e=>({id:`o-${e.id}`,tab:'orders',title:`New order ${e.ref}`,body:`${e.customerName} \xb7 ${(0,f.gbp)(e.total)}`,tone:k.colours.amber})),...n.filter(e=>(0,C.LIVE)(e)&&(0,S.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:k.colours.red})),...i.filter(e=>e.date===l&&'confirmed'===e.status&&(0,S.bookingNeedsAction)(e,n.filter(C.LIVE))).map(e=>({id:`ba-${e.id}`,tab:'bookings',title:`Allergy: ${e.name} at ${e.time}`,body:'Booked: allergy needs signing off',tone:k.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:k.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:k.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:k.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:k.colours.gold}]:[]];return{list:u,unread:u.filter(e=>!c[e.id]).length,read:c}}const G=[{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'}],Y=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 Q=[{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 X(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 J(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}},1440,[812,891,1140,899,780,1220,1222,17,264,362,219,385,85,409,864,777,858,1231,876,851,863,804,1178,1057,853,1055,1441,1161,1444,1445,1139,1146,1145,1008,839,1142,1149,1215,8]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return v}}),_e.Mark=F,_e.shareToSocial=function(e,t){b.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=O,_e.validate=D,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return U}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return G}}),_e.openQuickLink=H,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return K}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:i}=(0,k.useCtx)(6e4),l=(0,b.useOwner)(e=>e.quickLinks);return K(l,i).length?(0,w.jsxs)(m.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,w.jsx)(X,{go:e,compact:!0})]}):null},_e.QuickLinksRow=X,_e.QuickLinksSettings=function(){const{rid:e}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.quickLinks),s=(0,t.useSiteSetup)(e).email,[o,n]=(0,r.useState)(()=>i.map(e=>({...e}))),[a,d]=(0,r.useState)(s),[u,c]=(0,r.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[g,x]=(0,r.useState)(null),j=o.filter(e=>!e.builtIn).length,y=(e,t)=>{x(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),x(null))};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,w.jsx)(p.Field,{label:"Work email address",value:a,onChangeText:e=>{d(e),x(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,w.jsxs)(p.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",a.trim()?` for ${a.trim()}`:'',"."]})]}),(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Links (in tile order)"}),o.map((e,t)=>(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(p.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>v(t,-1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25b2"})}),(0,w.jsx)(h.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===o.length-1,onPress:()=>v(t,1),hitSlop:8,children:(0,w.jsx)(p.T,{colour:t===o.length-1?'#555':f.colours.gold,children:"\u25bc"})})]})]}),(0,w.jsx)(p.Field,{label:"Label",value:e.label,onChangeText:t=>y(e.id,{label:t})}),'gmail'===e.kind?(0,w.jsxs)(p.Muted,{children:["Email: ",a]}):(0,w.jsx)(p.Field,{label:"Web address",value:e.url,onChangeText:t=>y(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(t=>(0,w.jsx)(p.Chip,{label:t,selected:e.icon===t,onPress:()=>y(e.id,{icon:t})},t))}),(0,b.isWixLink)(e)||'gmail'===e.kind?(0,w.jsx)(p.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,w.jsx)(p.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>y(e.id,{staff:t})}),e.builtIn?null:(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{n(t=>t.filter(t=>t.id!==e.id)),x(null)}})]},e.id)),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.T,{weight:"semibold",children:["Add your own link (",j," / ",b.MAX_CUSTOM_LINKS,")"]}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:J.map(e=>(0,w.jsx)(p.Chip,{label:e.label,onPress:()=>c({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,w.jsx)(p.Field,{label:"New link label",value:u.label,onChangeText:e=>c({...u,label:e}),placeholder:"e.g. Google Business Profile"}),(0,w.jsx)(p.Field,{label:"New link web address",value:u.url,onChangeText:e=>c({...u,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Z.map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.icon===e,onPress:()=>c({...u,icon:e})},e))}),(0,w.jsx)(p.Button,{kind:"secondary",label:"Add link",disabled:j>=b.MAX_CUSTOM_LINKS,onPress:()=>{const e=ee(u.url);u.label.trim()&&te(e)?(n(t=>[...t,{id:P('ql'),label:u.label.trim(),url:e,icon:u.icon,kind:'link',staff:!1}]),c({label:'',url:'',icon:'\ud83c\udf10'}),x({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):x({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),g?(0,w.jsx)(p.Banner,{kind:g.ok?'success':'danger',title:g.ok?'Done':'Check these',children:g.text}):null,(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{label:"Save quick links",onPress:()=>{const t=[];ie(a)||t.push('The work email doesn\'t look like an email address.');const i=o.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':ee(e.url)}));i.forEach(e=>{e.label||t.push('Every link needs a label.'),'gmail'===e.kind||te(e.url)||t.push(`"${e.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),t.length?x({ok:!1,text:[...new Set(t)].join('\n')}):(b.useOwner.getState().setOwner({quickLinks:i}),l.useStore.getState().updateRestaurant(e,{contactEmail:a.trim()}),n(i),x({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,w.jsx)(p.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{n(b.DEFAULT_QUICK_LINKS.map(e=>({...e}))),x({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return se}}),_e.SocialPage=function(e){return o.LIVE_VENUE_BUILD?(0,w.jsxs)(m.default,{style:{gap:12},children:[(0,w.jsx)(p.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,w.jsx)(p.Muted,{children:"Open your social account directly to publish."})]}):(0,w.jsx)(_,{...e})},_e.SocialAccounts=function(){return o.LIVE_VENUE_BUILD?(0,w.jsx)(p.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,w.jsx)(q,{})};var t=_r(_d[0]),i=_r(_d[1]),l=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),a=(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[6]));_r(_d[7]);var r=_r(_d[8]),d=_r(_d[9]),u=e(_r(_d[10])),c=e(_r(_d[11]));_r(_d[12]);var h=e(_r(_d[13])),m=e(_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]),k=_r(_d[21]),y=_r(_d[22]),w=_r(_d[23]);const v={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'}},T=()=>(0,y.venueInfo)().name,C=100,S=()=>{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'])]},$=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],P=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,R=e=>e.toLocaleString('en-GB');function F({p:e,size:t=22}){const i=v[e];return(0,w.jsx)(m.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,w.jsx)(p.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:i.mark})})}function O({onPick:e}){const t=(0,b.useOwner)(e=>e.socialAccounts),i=({g:i,title:l,sub:s,marks:o})=>(0,w.jsxs)(h.default,{accessibilityRole:"button",accessibilityLabel:l,onPress:()=>e(i),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:f.colours.gold,backgroundColor:e?f.colours.goldTint:f.colours.surface,padding:14,gap:6}),children:[(0,w.jsxs)(p.Row,{gap:6,children:[o.map(e=>(0,w.jsx)(F,{p:e,size:26},e)),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.T,{colour:f.colours.gold,size:20,children:"\u203a"})]}),(0,w.jsx)(p.T,{weight:"bold",size:18,children:l}),(0,w.jsx)(p.Muted,{children:s}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:o.map(e=>(0,w.jsx)(p.Badge,{kind:t[e]?'ok':'neutral',label:`${v[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(0,w.jsx)(i,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,w.jsx)(i,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const I=(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:P('md')})),when:'now',day:0,time:'17:00',source:t?.source}),L=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),M=(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},B={feed:'Feed',reel:'Reel',story:'Story'},A={short:'YouTube Shorts',video:'YouTube video'};function D(e,t,i){const l=[],s=L(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>C&&l.push(`The YouTube title is too long (${e.ytTitle.length} / ${C}).`),e.tt&&!e.text.trim()&&l.push('Add a caption for TikTok.')),s.forEach(t=>{e.text.length>v[t].limit&&l.push(`The text is too long for ${v[t].name} (${R(e.text.length)} / ${v[t].limitLabel}).`)}),s.forEach(e=>{t[e]||l.push(`${v[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&M(e,i).getTime()<=i.getTime()+3e5&&l.push('Pick a time at least 5 minutes from now.'),l}function E({m:e,size:t=84}){const[i,l]=(0,r.useState)(!1);return(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:e.uri},onError:()=>l(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||i?(0,w.jsx)(p.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:i?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,w.jsx)(p.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function z({p:e,n:t,title:i}){const l='yt-title'===e?C:v[e].limit,s=t>l,o=t>.9*l,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':v[e].name;return(0,w.jsx)(p.Badge,{kind:s?'red':o?'amber':'neutral',label:`${n} ${R(t)} / ${'yt-title'===e?C:v[e].limitLabel}`})}function Y({p:e,d:t}){const i=t.media[0],l=t.text.trim()||'Your text appears here.',o=(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(F,{p:e,size:20}),(0,w.jsx)(p.T,{weight:"semibold",size:14,children:T()}),(0,w.jsx)(m.default,{style:{flex:1}}),(0,w.jsx)(p.Muted,{children:'instagram'===e?B[t.igFormat]:'youtube'===e?A[t.ytFormat]:v[e].name})]}),n=(e,l="100%")=>i?(0,w.jsxs)(m.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,w.jsx)(u.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,w.jsx)(p.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,w.jsx)(p.T,{size:12,colour:"#fff",children:i.name}),t.media.length>1?(0,w.jsx)(m.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,w.jsxs)(p.T,{size:11,colour:"#fff",children:["1/",t.media.length]})}):null]}):(0,w.jsx)(m.default,{style:{width:l,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:f.colours.border,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(p.Muted,{children:"No media yet"})});return(0,w.jsxs)(m.default,{accessibilityLabel:`${v[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,s.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:f.colours.border,padding:10,gap:8},children:[o,'facebook'===e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{size:14,numberOfLines:5,children:l}),t.media.length?n(1.25):null,(0,w.jsx)(p.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,w.jsxs)(w.Fragment,{children:[n('feed'===t.igFormat?1:.5625,'feed'===t.igFormat?'100%':'60%'),t.media.length>1&&'feed'===t.igFormat?(0,w.jsx)(p.Row,{gap:4,style:{justifyContent:'center'},children:t.media.slice(0,10).map((e,t)=>(0,w.jsx)(m.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==t.igFormat?(0,w.jsxs)(p.T,{size:13,numberOfLines:3,children:[(0,w.jsx)(p.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),l]}):(0,w.jsx)(p.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,w.jsxs)(m.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,w.jsx)(p.T,{size:12,numberOfLines:3,style:{marginTop:4},children:l})]}):null,'youtube'===e?(0,w.jsxs)(w.Fragment,{children:['short'===t.ytFormat?(0,w.jsx)(m.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,w.jsx)(p.T,{weight:"semibold",size:14,numberOfLines:2,children:t.ytTitle.trim()||'Your YouTube title'}),(0,w.jsxs)(p.Muted,{children:[T()," \xb7 ",'public'===t.ytVisibility?'Public':'unlisted'===t.ytVisibility?'Unlisted':'Private']})]}):null]})}function N({onInsert:e,onClose:t}){const{rid:i,r:l,now:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.offers),a=(0,b.useOwner)(e=>e.quickLinks),r=(0,g.useEvents)(i).filter(e=>e.restaurantId===i&&e.date>=(0,x.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=o.find(e=>'special'===e.kind&&e.live),c=(0,n.kitchenHoursOn)(l,s),m=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=[1,2,3,4,5,6,0].map(e=>{const t=(0,n.kitchenHoursOn)(l,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${m[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:c?`Kitchen today ${c[0]}\u2013${c[1]}`:'Kitchen closed today',text:`Kitchen hours: ${j}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,x.niceDate)((0,x.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,x.niceDate)((0,x.parseYmd)(e.date))} at ${(0,y.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,w.jsx)(p.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(i=>(0,w.jsxs)(h.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:f.colours.border,backgroundColor:e?f.colours.goldTint:f.colours.surface,opacity:i.disabled?.4:1}),children:[(0,w.jsx)(p.T,{weight:"medium",children:i.label}),(0,w.jsx)(p.Muted,{children:i.sub})]},i.label))})}function W({initial:e,onClose:t,onDone:l}){const{now:s,role:o,me:n}=(0,k.useCtx)(3e4),d=(0,b.useOwner)(e=>e.socialAccounts),[u,c]=(0,r.useState)(e),[g,C]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),[W,V]=(0,r.useState)(!1),[_,q]=(0,r.useState)(!1),[U,G]=(0,r.useState)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{H.current&&clearInterval(H.current)},[]);const Q=e=>c(t=>({...t,...e})),K=L(u),X=D(u,d,s),Z=b.CAN.publishSocial(o),J='meta'===u.group,ee=e=>{const t=u.media.length,i={id:P('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:$[t%$.length],duration:'video'===e?24:void 0};Q({media:J?[...u.media,i].slice(0,10):[i]})},te=(e,t)=>{const i=[...u.media],l=e+t;l<0||l>=i.length||([i[e],i[l]]=[i[l],i[e]],Q({media:i}))},ie=e=>Q({text:u.text.includes(e)?u.text.replace(new RegExp(`\\s?${e}\\b`),''):`${u.text.trimEnd()}${u.text.trim()?' ':''}${e}`}),le=(e,t)=>{const i='later'===u.when;b.useOwner.getState().addSocialPost({group:u.group,platforms:K,igFormat:u.igFormat,ytFormat:u.ytFormat,ytTitle:u.ytTitle.trim(),ytVisibility:u.ytVisibility,text:u.text.trim(),media:u.media,scheduleAt:i?M(u,s).toISOString():void 0,createdAt:s.toISOString(),by:n,byRole:o,status:t,results:e})};return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,w.jsx)(p.Row,{gap:6,children:(J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(F,{p:e},e))})]}),(0,w.jsx)(p.T,{weight:"bold",size:20,children:J?'Facebook + Instagram':'TikTok + YouTube'}),(0,w.jsx)(p.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."}),u.source?(0,w.jsx)(p.Banner,{kind:"info",title:"Prefilled",children:`From ${u.source}. Edit anything before publishing.`}):null,Z?null:(0,w.jsx)(p.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"Where to post"}),J?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"Facebook Page",value:u.fb,onChange:e=>Q({fb:e})}),(0,w.jsx)(p.Toggle,{label:"Instagram",value:u.ig,onChange:e=>Q({ig:e})}),(0,w.jsx)(p.Muted,{children:u.fb&&u.ig?'Both':u.fb?'Facebook only':u.ig?'Instagram only':'Nothing selected'}),u.ig?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Muted,{children:"Instagram as"}),(0,w.jsx)(p.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,w.jsx)(p.Chip,{label:B[e],selected:u.igFormat===e,onPress:()=>Q({igFormat:e})},e))})]}):null]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Toggle,{label:"TikTok",value:u.tt,onChange:e=>Q({tt:e})}),(0,w.jsx)(p.Toggle,{label:"YouTube",value:u.yt,onChange:e=>Q({yt:e})}),u.yt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{gap:6,children:['short','video'].map(e=>(0,w.jsx)(p.Chip,{label:A[e],selected:u.ytFormat===e,onPress:()=>Q({ytFormat:e})},e))}),(0,w.jsx)(p.Field,{label:"YouTube title",value:u.ytTitle,onChangeText:e=>Q({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,y.venueInfo)().name}`}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(0,w.jsx)(z,{p:"yt-title",n:u.ytTitle.length})}),(0,w.jsx)(p.Muted,{children:"Visibility"}),(0,w.jsx)(p.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,w.jsx)(p.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:u.ytVisibility===e,onPress:()=>Q({ytVisibility:e})},e))})]}):null]})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Photos and videos':'Video'}),(0,w.jsx)(p.Muted,{children:J?`${u.media.length} / 10`:u.media.length?'1 video':'none'})]}),(0,w.jsx)(p.Button,{kind:"secondary",label:J?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await a.launchImageLibraryAsync({mediaTypes:J?['images','videos']:['videos'],allowsMultipleSelection:J,selectionLimit:J?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:P('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${u.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));Q({media:J?[...u.media,...t].slice(0,10):t.slice(0,1)})}}),(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:[J?(0,w.jsx)(p.Chip,{label:"Example photo",onPress:()=>ee('image')}):null,(0,w.jsx)(p.Chip,{label:"Example video",onPress:()=>ee('video')})]}),u.media.length?(0,w.jsx)(p.Row,{wrap:!0,gap:8,children:u.media.map((e,t)=>(0,w.jsxs)(m.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,w.jsx)(E,{m:e}),(0,w.jsxs)(p.Row,{gap:4,children:[J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>te(t,-1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:0===t?'#555':f.colours.gold,children:"\u25c0"})}):null,(0,w.jsx)(i.GoldClose,{size:"sm",label:`Remove item ${t+1}`,onPress:()=>Q({media:u.media.filter(t=>t.id!==e.id)})}),J?(0,w.jsx)(h.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===u.media.length-1,onPress:()=>te(t,1),hitSlop:6,children:(0,w.jsx)(p.T,{colour:t===u.media.length-1?'#555':f.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,w.jsx)(p.Muted,{children:J?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.T,{weight:"semibold",children:J?'Post text':'Caption / description'}),(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>I(!0)})]}),(0,w.jsx)(p.Field,{label:"Text",value:u.text,onChangeText:e=>Q({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,y.venueInfo)().name}?`,style:{minHeight:110}}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:(K.length?K:J?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,w.jsx)(z,{p:e,n:u.text.length},e))}),(0,w.jsx)(p.Muted,{children:"Hashtags"}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:S().map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.text.includes(e),onPress:()=>ie(e)},e))})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"When"}),(0,w.jsxs)(p.Row,{gap:6,children:[(0,w.jsx)(p.Chip,{label:"Post now",selected:'now'===u.when,onPress:()=>Q({when:'now'})}),(0,w.jsx)(p.Chip,{label:"Schedule",selected:'later'===u.when,onPress:()=>Q({when:'later',day:u.day||1})})]}),'later'===u.when?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const i=new Date(s);return i.setDate(i.getDate()+t),(0,w.jsx)(p.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,x.niceDate)(i),selected:u.day===t,onPress:()=>Q({day:t})},t)})}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,w.jsx)(p.Chip,{label:e,selected:u.time===e,onPress:()=>Q({time:e})},e))}),(0,w.jsxs)(p.Muted,{children:["Goes out ",(0,x.niceDate)(M(u,s))," at ",u.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,w.jsx)(j.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,w.jsxs)(p.Row,{wrap:!0,gap:10,children:[(K.length?K:[]).map(e=>(0,w.jsx)(Y,{p:e,d:u},e)),K.length?null:(0,w.jsx)(p.Muted,{children:"Choose at least one platform to see a preview."})]}),g&&X.length?(0,w.jsx)(p.Banner,{kind:"danger",title:"Before you publish",children:X.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{C(!0),X.length||V(!0)}}),O?(0,w.jsx)(N,{onClose:()=>I(!1),onInsert:e=>Q({text:`${u.text.trimEnd()}${u.text.trim()?'\n':''}${e}`})}):null,W?(0,w.jsxs)(p.Sheet,{visible:!0,onClose:()=>null==U?V(!1):null,title:Z?'Ready to publish?':'Send for approval?',children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,w.jsx)(p.T,{weight:"semibold",children:Z?'This will go to:':'When approved, this will go to:'}),K.map(e=>(0,w.jsxs)(p.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,w.jsx)(F,{p:e}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"medium",children:[v[e].account," \xb7 ",T()]}),(0,w.jsx)(p.Muted,{children:'instagram'===e?`${B[u.igFormat]}${'feed'===u.igFormat&&u.media.length>1?` (carousel of ${u.media.length})`:''}`:'youtube'===e?`${A[u.ytFormat]} \xb7 "${u.ytTitle.trim()}" \xb7 ${u.ytVisibility}`:'facebook'===e?"Page post"+(u.media.length?` with ${u.media.length} item${u.media.length>1?'s':''}`:''):'Video post'}),null!=U?(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.border,marginTop:4},children:(0,w.jsx)(m.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,U)}%`,backgroundColor:f.colours.gold}})}):null]})]},e)),(0,w.jsxs)(p.Muted,{children:['later'===u.when?`Scheduled for ${(0,x.niceDate)(M(u,s))} at ${u.time}.`:'Posts now.'," ",u.media.length," media item",1===u.media.length?'':'s'," \xb7 ",R(u.text.length)," characters."]}),Z?(0,w.jsx)(p.Toggle,{label:"Simulate a failure on the last platform (demo)",value:_,onChange:q}):null,null!=U?(0,w.jsxs)(p.T,{colour:f.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(U)),"%"]}):(0,w.jsxs)(p.Row,{gap:8,children:[(0,w.jsx)(p.Button,{kind:"ghost",label:"Back to edit",onPress:()=>V(!1),style:{flex:1}}),(0,w.jsx)(p.Button,{label:Z?'later'===u.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!Z)return le({},'awaiting approval'),V(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');G(0),H.current=setInterval(()=>G(e=>{const t=(e??0)+12.5;if(t>=100){H.current&&clearInterval(H.current);const e='later'===u.when,t=Object.fromEntries(K.map((t,i)=>[t,_&&i===K.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{V(!1),G(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,x.niceDate)(M(u,s))} ${u.time}.`:_?'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 V({onDuplicate:e}){const{role:t,me:i,now:l}=(0,k.useCtx)(3e4),s=(0,b.useOwner)(e=>e.socialPosts),o=(0,b.useOwner)(e=>e.setSocialPost),n=b.CAN.publishSocial(t);return s.length?(0,w.jsx)(m.default,{style:{gap:8},children:s.map(t=>{const s=new Date(t.scheduleAt??t.createdAt);return(0,w.jsxs)(p.Card,{highlight:'awaiting approval'===t.status?f.colours.amber:void 0,children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(p.Row,{gap:4,children:t.platforms.map(e=>(0,w.jsx)(F,{p:e,size:18},e))}),(0,w.jsxs)(p.Muted,{children:[t.scheduleAt?'For ':'',(0,x.niceDate)(s)," ",s.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,w.jsx)(p.T,{weight:"semibold",children:t.ytTitle}):null,(0,w.jsx)(p.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,w.jsxs)(p.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${B[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${A[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,w.jsx)(p.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,w.jsx)(p.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,w.jsx)(p.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const i=t.results[e];return(0,w.jsx)(p.Badge,{kind:'Posted'===i?'ok':'Scheduled'===i?'blue':'red',label:`${v[e].name}: ${i??'\u2014'}`},e)})}),'done'===t.status?(0,w.jsx)(p.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,w.jsxs)(p.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.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,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,w.jsxs)(p.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,w.jsx)(p.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function _({go:e}){const{role:t}=(0,k.useCtx)(6e4),i=(0,b.useOwner)(e=>e.socialDraft),l=(0,b.useOwner)(e=>e.socialPosts),[s,o]=(0,r.useState)(null),[n,a]=(0,r.useState)(null),[d,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{i&&(o(I(i.group,i)),a(null),b.useOwner.getState().setOwner({socialDraft:void 0}))},[i]);const c=l.filter(e=>'awaiting approval'===e.status).length,h=b.CAN.publishSocial(t);return s?(0,w.jsx)(W,{initial:s,onClose:()=>o(null),onDone:e=>{o(null),a(e)}},d):(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.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,w.jsx)(p.Banner,{kind:"success",title:n.split('.')[0],children:n.includes('.')&&n.slice(n.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,c&&h?(0,w.jsx)(p.Banner,{kind:"warn",title:`${c} post${c>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,h?null:(0,w.jsx)(p.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,w.jsx)(j.SectionHead,{title:"Post to social"}),(0,w.jsx)(O,{onPick:e=>{a(null),u(e=>e+1),o(I(e))}}),h?(0,w.jsx)(p.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,w.jsx)(j.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,w.jsx)(V,{onDuplicate:e=>{a(null),u(e=>e+1),o(I(e.group,{...e,source:'a previous post'}))}})]})}function q(){const e=(0,b.useOwner)(e=>e.socialAccounts),t=(e,t)=>b.useOwner.getState().setOwner({socialAccounts:{...b.useOwner.getState().socialAccounts,[e]:t}}),i=({p:i,via:l})=>(0,w.jsxs)(p.Row,{gap:10,children:[(0,w.jsx)(F,{p:i,size:30}),(0,w.jsxs)(m.default,{style:{flex:1},children:[(0,w.jsxs)(p.T,{weight:"semibold",children:[v[i].account,l?` (${l})`:'']}),(0,w.jsx)(p.Muted,{children:e[i]?`Connected as ${T()} (mock)`:'Not connected'})]}),(0,w.jsx)(p.Button,{small:!0,kind:e[i]?'ghost':'primary',label:e[i]?'Disconnect':'Connect',accessibilityLabel:`${e[i]?'Disconnect':'Connect'} ${v[i].name}`,onPress:()=>t(i,!e[i])})]});return(0,w.jsxs)(m.default,{style:{gap:10},children:[(0,w.jsx)(p.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Meta"}),(0,w.jsx)(i,{p:"facebook",via:"via Meta"}),(0,w.jsx)(i,{p:"instagram",via:"via Meta"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",colour:f.colours.gold,children:"Video"}),(0,w.jsx)(i,{p:"tiktok"}),(0,w.jsx)(i,{p:"youtube"})]}),(0,w.jsxs)(p.Card,{children:[(0,w.jsx)(p.T,{weight:"semibold",children:"For real posting"}),(0,w.jsx)(p.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 U=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',G=(e,t)=>'gmail'===e.kind?U(t):e.url;async function H(e,t){return e.kind,await c.default.openURL(G(e,t)),'web'}const Q=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},K=(e,t)=>'chef'!==t||(0,d.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,b.isWixLink)(e)&&'gmail'!==e.kind):[];function X({go:e,compact:i}){const{role:l,rid:s}=(0,k.useCtx)(6e4),o=(0,b.useOwner)(e=>e.quickLinks),n=(0,t.useSiteSetup)(s).email,[a,d]=(0,r.useState)(null),u=K(o,l),c=[];u.forEach(e=>{const t=e.group??e.id,i=c.find(e=>e.key===t);i?i.items.push(e):c.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const g=async e=>{const t=await H(e,n).catch(()=>null);d(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':Q(G(e,n))}`:`Couldn't open ${e.label}`)};return c.length?(0,w.jsxs)(m.default,{style:{gap:6},children:[(0,w.jsx)(p.Row,{wrap:!0,gap:10,children:c.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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(m.default,{style:{gap:6,alignItems:'center',width:'100%',minWidth:0},children:[(0,w.jsxs)(p.Row,{wrap:!0,style:{justifyContent:'center'},children:[(0,w.jsx)(p.T,{size:22,children:s}),t?(0,w.jsx)(p.T,{colour:f.colours.gold,size:18,children:"\u2197"}):null]}),(0,w.jsx)(p.T,{center:!0,weight:"bold",size:16,style:{width:'100%'},children:e.title})]}),(0,w.jsx)(p.Muted,{numberOfLines:1,children:l?n||'Opens Gmail \xb7 set your work email in Quick links':Q(t?t.url:e.items[0].url)}),t?null:(0,w.jsx)(m.default,{style:{gap:6,width:'100%',minWidth:0},children:e.items.map(t=>(0,w.jsx)(p.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>g(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:f.colours.gold,backgroundColor:f.colours.surface,padding:12,gap:6};return t?(0,w.jsx)(h.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>g(t),style:({pressed:e})=>[a,e&&{backgroundColor:f.colours.goldTint}],children:o},e.key):(0,w.jsx)(m.default,{style:a,children:o},e.key)})}),a?(0,w.jsx)(p.Muted,{children:a}):null,e&&b.CAN.manage(l)?(0,w.jsx)(p.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Z=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],J=[{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'}],ee=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},te=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),ie=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const le=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,x.niceDate)((0,x.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,C)}},se=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,C)}}},1441,[886,779,816,813,822,862,1039,1442,17,909,319,362,219,385,85,777,858,876,863,804,1178,1057,1215,8]); +__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})({})},1442,[482,1443]); +__d(function(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={}},1443,[]); +__d(function(g,r,_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,{money:!0,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,{money:!0,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})})]})}},1444,[812,17,1245,1026,854,362,385,85,777,876,851,863,804,1178,1057,1215,8]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"register",{enumerable:!0,get:function(){return p}}),_e.MoreMenu=function({go:e}){const{role:l}=(0,u.useCtx)(6e4),p=(0,c.useChatUnread)().total;return(0,f.jsxs)(o.default,{style:{gap:14},children:[h.map(t=>{const u=g.filter(e=>e.group===t&&(!e.can||e.can(l)));return u.length?(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsx)(s.T,{size:12,weight:"semibold",colour:i.colours.gold,children:t.toUpperCase()}),(0,f.jsx)(o.default,{style:{borderRadius:14,borderWidth:1,borderColor:i.colours.border,backgroundColor:i.colours.surface,overflow:'hidden'},children:u.map((t,l)=>(0,f.jsx)(n.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)(o.default,{style:{flex:1},children:[(0,f.jsx)(s.T,{weight:"medium",children:t.title}),(0,f.jsx)(s.Muted,{children:t.sub})]}),'chat'===t.id&&p?(0,f.jsx)(s.Badge,{kind:"red",label:String(p)}):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'===b.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]})},Object.defineProperty(_e,"pageFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return l.CAN}});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]),i=r(d[6]),u=r(d[7]),c=r(d[8]),b=r(d[9]),f=r(d[10]);const g=[],p=e=>{e.forEach(e=>{g.some(t=>t.id===e.id)||g.push(e)})},h=['Start here','Settings','Run the day','Team','Manage app','Grow','Compliance','Account'];const j=e=>g.find(t=>t.id===e)},1445,[978,17,385,85,777,876,804,1057,1161,899,8]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.deviceKind=o,e.deviceSyncLine=function(r,c){const l=Date.parse(r.seen_at),u=r.last_synced_at?Date.parse(r.last_synced_at):0,$=c-l>18e4,h=!u||l-u>6e4,p=!$&&!h,_=`${t[r.app]??r.app}${r.who?` \xb7 ${r.who}`:''} \xb7 ${o(r.user_agent)}`,f=$?`Not reporting since ${n(r.seen_at)} (${s(c-l)})${u?`, last synced ${n(r.last_synced_at)}`:''}`:h?`Out of sync${u?` since ${n(r.last_synced_at)}`:''}, reconnecting`:`In sync \xb7 last synced ${n(r.last_synced_at)} (${s(c-u)})`,y=[r.version??'','SUBSCRIBED'===r.realtime?'live channel on':`live channel ${String(r.realtime??'off').toLowerCase()}`];r.pending&&y.push(`${r.pending} change${1===r.pending?'':'s'} waiting`);r.failed&&y.push(`${r.failed} not saved`);return{ok:p,title:_,state:f,detail:y.filter(Boolean).join(' \xb7 ')}};const t={owner:'Managers',staff:'Staff',chef:'Chef',display:'Display',car:'Car'},n=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),s=t=>t<9e4?`${Math.max(0,Math.round(t/1e3))} s ago`:t<54e5?`${Math.round(t/6e4)} min ago`:`${Math.round(t/36e5)} h ago`;function o(t){const n=t??'';return/CoverChargeTablet|TB\d|Tablet/i.test(n)?'tablet':/iPhone/i.test(n)?'iPhone':/iPad/i.test(n)?'iPad':/Android/i.test(n)?'Android':/Tesla/i.test(n)?'car':/Mac OS X|Windows|Linux/i.test(n)?'computer':'device'}},1446,[]); +__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)','')},1447,[843,17,85,777,876,998,863,1060,1058,899,1059,805,916,804,8]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return C}}),_e.personFromStaff=P,_e.signInWithText=H,_e.SignInWithLink=E,_e.signInWithHandover=O,_e.useSignedOutGate=function(){const e=(0,u.useSession)(e=>e.meId),t=(0,p.useSync)(e=>'device'===e.kind&&!!e.venueId);return r.IS_CAR?!m.PITCH&&!t:x.includes(r.APP_VARIANT)&&!m.PITCH&&!e&&!z()},_e.InviteGate=function(){const[e,A]=(0,n.useState)(u.useSession.persist.hasHydrated()),[P,H]=(0,n.useState)(u.START_INVITE||u.START_HANDOVER||u.START_KITCHEN?'checking':'done'),[V,M]=(0,n.useState)(null),[F,W]=(0,n.useState)(null),[K,L]=(0,n.useState)(0),[U,Y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),X=(0,u.useSession)(e=>e.meId),$=(0,u.useSession)(e=>!X||!!e.welcomed[X]);if((0,n.useEffect)(()=>{const e=u.useSession.persist.onFinishHydration(()=>A(!0));return u.useSession.persist.hasHydrated()&&A(!0),e},[]),(0,n.useEffect)(()=>{if(!e||!x.includes(r.APP_VARIANT))return;let t,n=!0;return(async()=>{const e=u.useSession.getState().meId;if(u.START_KITCHEN&&'chef'===r.APP_VARIANT&&!e){const e=await(0,p.claimDisplayKitchen)(u.START_KITCHEN);if(!n)return;if('ok'===e.status&&e.id.staffRef){(0,k.markKitchenViaDisplay)(!0,e.id.displayName),N(e.id);try{u.useSession.getState().markWelcomed(e.id.staffRef)}catch{}return void H('done')}return M('refused'===e.status?e.message:'Could not open the Head Chef app. Go back to the Display and enter the code again.'),void H('done')}if(u.START_HANDOVER&&!u.START_INVITE&&!D){D=!0;const t=await(0,p.claimChromeHandover)(u.START_HANDOVER);if(!n)return;if('ok'===t.status&&t.id.staffRef)N(t.id);else if('refused'===t.status&&!e)return W(t.message),void H('done')}if(u.START_INVITE&&!(e&&await(0,p.signedInHereAs)(e)&&await(0,p.rememberedInviteHere)(u.START_INVITE))){const e=await _(u.START_INVITE,e=>{n&&W(e)});if(!n)return;if('refused'===e.kind)return W(e.message),void H('done');if('offline'===e.kind)return Y(!0),void(t=setTimeout(()=>{n&&L(e=>e+1)},1e4));if(Y(!1),'bad'===e.kind)return void H('bad')}const s=R(u.useSession.getState().meId),o=s&&!1!==b.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)u.useSession.getState().signOut();else if(s&&!j(s)&&!u.START_INVITE&&await(0,p.signedInHereAs)(s.id)){if(await(0,p.forgetSignInHere)(),!n)return;u.useSession.getState().signOut(),G(C(s.app))}else if(s&&!j(s)){const e=(0,u.appUrl)(s.app,u.START_INVITE);if(e)return void window.location.replace(e)}H('done')})(),()=>{n=!1,t&&clearTimeout(t)}},[e,K]),!x.includes(r.APP_VARIANT))return null;const q=(0,t.IsolatedVenueWelcome)({meId:X,refused:F,waiting:U,hydrated:e,state:P});if(q)return q;if(U)return v('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===P)return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}]});if(r.IS_OWNER_DESKTOP&&!X&&!m.PITCH&&!z())return(0,I.jsx)(o.default,{style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3}],children:(0,I.jsx)(l.DesktopSignIn,{onCode:O,refused:F})});if((0,T.inPhoneApp)()&&!X&&!m.PITCH)return F&&/already been used/i.test(F)?v(S,'invite-app-used'):F&&(0,y.isPhoneLinked)(F)?v(y.PHONE_LINKED_TEXT,'invite-phone-linked'):F?v(F,'invite-app-refused'):v(w,'invite-app-notsetup');if('bad'===P)return(0,I.jsxs)(o.default,{testID:"invite-bad",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,I.jsx)(h.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>H('done')}),(0,I.jsx)(h.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(F&&!X&&(0,y.isPhoneLinked)(F))return(0,I.jsxs)(o.default,{testID:"invite-phone-linked",accessible:!0,accessibilityLabel:`This link is linked to another phone. ${y.PHONE_LINKED_TEXT}`,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:14,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:24,weight:"bold",center:!0,colour:f.colours.gold,accessibilityRole:"header",children:"This link is linked to another phone"}),(0,I.jsx)(h.T,{size:18,center:!0,style:{maxWidth:420},children:"Ask a manager to reset it or send you a new link."}),(0,I.jsx)(h.Muted,{center:!0,style:{maxWidth:420},children:"Each personal link works on the first phone that opens it. Once your manager has reset it, open the same link again here."})]});if(F&&!X)return(0,I.jsxs)(o.default,{testID:"invite-refused",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,I.jsx)(h.Muted,{center:!0,children:F}),(0,I.jsx)(h.Muted,{center:!0,children:"Your personal link works for good on the first phone you open it on."}),(0,I.jsx)(h.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>W(null)})]});if(B&&!X)return(0,I.jsxs)(o.default,{testID:"invite-moved",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,I.jsx)(h.Muted,{center:!0,children:B}),(0,I.jsx)(E,{})]});if(V&&!X){const e=/expired/i.test(V);return(0,I.jsxs)(o.default,{testID:e?'kitchen-unlock-expired':'kitchen-unlock-failed',style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e?'That unlock has expired':'Could not open the Head Chef app'}),(0,I.jsx)(h.Muted,{center:!0,children:V}),(0,I.jsx)(h.Muted,{center:!0,children:"Use Back to Display, then enter the unlock code again. Do not use a personal link on this tablet."})]})}if(!X&&!m.PITCH&&!z())return(0,I.jsxs)(o.default,{testID:"invite-signin",style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:F?'This link can\u2019t be used here':'Sign in to CoverCharge'}),F?(0,I.jsx)(h.Muted,{center:!0,children:F}):null,(0,I.jsx)(h.Muted,{center:!0,children:"Open the personal link your manager shared with you. It works for good on the first phone you open it on."}),(0,I.jsx)(E,{})]});const J=(0,u.rosterPerson)(X);return J&&!$&&j(J)&&!(0,k.isKitchenViaDisplay)()?(0,I.jsx)(c.LaunchWelcome,{p:J,onDone:()=>u.useSession.getState().markWelcomed(J.id)}):null};var t=_r(d[0]),n=_r(d[1]);_r(d[2]);var s=e(_r(d[3])),o=e(_r(d[4])),r=_r(d[5]),l=_r(d[6]),u=_r(d[7]),f=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),k=_r(d[12]),m=_r(d[13]),T=_r(d[14]),y=_r(d[15]),b=_r(d[16]),I=_r(d[17]);const S='This app copy has already been set up on another phone. Ask your manager for a new link.',w='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',v=(e,t)=>(0,I.jsx)(o.default,{testID:t,style:[s.default.absoluteFill,{backgroundColor:f.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,I.jsx)(h.T,{size:22,weight:"bold",center:!0,children:e})}),x=['owner','staff','chef'],j=e=>'staff'===r.APP_VARIANT||e.app===r.APP_VARIANT,C=e=>`You now use ${u.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function A(e){u.useSession.getState().signIn(e.id);const t=b.useOwner.getState();b.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?t.previewRole:e.role})}function P(e){const t='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:t,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===t?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const R=e=>{const t=(0,u.rosterPerson)(e);if(t)return t;const n=e?b.useOwner.getState().staff.find(t=>t.id===e):void 0;return n?P(n):void 0};async function _(e,t){const n=await(0,u.personForInvite)(e);if(n)return A(n),j(n)?((0,p.claimInvite)(e).then(e=>{if('refused'===e.status&&u.useSession.getState().meId===n.id&&(u.useSession.getState().signOut(),t(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==u.useSession.getState().meId){const t=R(e.id.staffRef);t&&A(t)}}),{kind:'ok',p:n}):{kind:'ok',p:n};const s=await(0,p.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=R(s.id.staffRef)??P({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return A(o),{kind:'ok',p:o}}async function H(e,t=()=>{}){const n=(0,u.inviteFromText)(e);if(!n)return'bad';const s=await _(n,t);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!j(o)){const e=(0,u.appUrl)(o.app,n);if(e)return window.location.replace(e),'moved'}return'ok'}function E(){const[e,t]=(0,n.useState)(''),[s,r]=(0,n.useState)('');return(0,I.jsxs)(o.default,{style:{gap:6},children:[(0,I.jsx)(h.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:t,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,I.jsx)(h.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const n=await H(e,r);r('bad'===n?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof n?n.refused:''),'ok'===n&&t('')}}),s?(0,I.jsx)(h.T,{size:13,colour:f.colours.red,children:s}):null]})}function N(e){if(!e.staffRef)return;A(R(e.staffRef)??P({id:e.staffRef,name:e.displayName||e.staffRef,role:'owner'===e.role?'owner':'manager'===e.role?'manager':'staff',level:'head_chef'===e.role?'Head Chef':void 0,job:'',active:!0}))}async function O(e){const t=await(0,p.claimChromeHandover)(e);return'ok'===t.status?t.id.staffRef?(N(t.id),'ok'):'bad':'refused'===t.status?{refused:t.message}:'offline'===t.status?'offline':'bad'}let D=!1;const z=()=>'undefined'!=typeof window&&('localhost'===window.location.hostname||'127.0.0.1'===window.location.hostname)&&['tips','home'].includes(new URLSearchParams(window.location.search).get('demo')||'')},1448,[1449,17,219,24,85,856,1450,920,804,1452,777,899,922,880,1069,918,876,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.IsolatedVenueWelcome=function(n){return null}},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.DesktopSignIn=function({onCode:e,refused:h}){const[p,f]=(0,n.useState)(''),[k,x]=(0,n.useState)(h?(0,c.desktopRefusal)(h):''),[j,y]=(0,n.useState)(!1),b=async()=>{const n=(0,c.handoverCodeFrom)(p);if(!n)return void x('That doesn\u2019t look like a sign-in link or code. Copy the whole link from your phone, or type the code.');y(!0),x('Signing in\u2026');const o=await e(n);y(!1),x('ok'===o?'':'offline'===o?'No connection. Check this computer is online and try again.':'bad'===o?'That code wasn\u2019t recognised. Make a new one on your phone.':(0,c.desktopRefusal)(o.refused)),'ok'===o&&f('')};return(0,u.jsx)(o.default,{testID:"desk-signin",style:{flex:1,backgroundColor:l.colours.bg},contentContainerStyle:{flexGrow:1,alignItems:'center',justifyContent:'center',padding:32},children:(0,u.jsxs)(t.default,{role:"main",style:{width:'100%',maxWidth:560,gap:16,alignItems:'center'},children:[(0,u.jsx)(s.RestaurantLogo,{size:96}),(0,u.jsx)(t.default,{role:"heading",'aria-level':1,children:(0,u.jsx)(r.T,{size:28,weight:"bold",center:!0,children:"CoverCharge for desktop"})}),(0,u.jsx)(r.Muted,{center:!0,children:"For owners, on a Mac or PC. The same account, bookings and permissions as your phone."}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8,padding:18,borderRadius:14,borderWidth:1,borderColor:l.colours.border,backgroundColor:l.colours.surface},children:[(0,u.jsx)(r.T,{weight:"semibold",center:!0,children:"To sign in on this computer"}),(0,u.jsx)(r.T,{size:14,center:!0,children:"1. On your phone, open CoverCharge Managers."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"2. Tap More, then Use on a computer, then Make a sign-in link."}),(0,u.jsx)(r.T,{size:14,center:!0,children:"3. Send the link to yourself (or read out the code), then open it here or paste it below."}),(0,u.jsx)(r.Muted,{center:!0,children:"The link works once, for 10 minutes. Your phone stays signed in."})]}),(0,u.jsxs)(t.default,{style:{alignSelf:'stretch',gap:8},children:[(0,u.jsx)(r.Field,{label:"Sign-in link or code",value:p,onChangeText:f,placeholder:"Paste the link, or type the code",autoCapitalize:"none",autoCorrect:!1,testID:"desk-signin-code",onSubmitEditing:b}),(0,u.jsx)(r.Button,{label:j?'Signing in\u2026':'Sign in',disabled:j||!p.trim(),onPress:b,testID:"desk-signin-go"}),(0,u.jsx)(t.default,{accessibilityLiveRegion:"polite",'aria-live':'polite',children:k?(0,u.jsx)(r.T,{size:14,colour:'Signing in\u2026'===k?l.colours.muted:l.colours.red,center:!0,children:k}):null})]})]})})};var n=_r(d[0]),o=e(_r(d[1])),t=e(_r(d[2])),r=_r(d[3]),s=_r(d[4]),l=_r(d[5]),c=_r(d[6]),u=_r(d[7])},1450,[17,278,85,777,857,804,1451,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DESKTOP_EXPIRED",{enumerable:!0,get:function(){return n}}),e.handoverCodeFrom=function(n){const t=(n||'').trim();if(!t)return null;const o=t.match(/[#&]ccchrome=([A-Za-z0-9_-]{24,64})(?:&|\s|$)/);if(o)return o[1];if(/[/#?=]/.test(t))return null;const c=t.replace(/\s+/g,'');return/^[A-Za-z0-9_-]{24,64}$/.test(c)?c:null},e.desktopLinkFor=function(n,t){try{const o=new URL(n),c=o.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer|car)-app\/|^(.*?\/)owner-desktop\//),s=c?c[1]??c[2]:o.pathname.replace(/[^/]*$/,'');return`${o.origin}${s}owner-desktop/index.html#ccchrome=${t}`}catch{return null}},Object.defineProperty(e,"codeGroups",{enumerable:!0,get:function(){return t}}),e.desktopRefusal=function(t){return/no longer active/i.test(t)?'This person is no longer active in CoverCharge. Ask the other owner.':/expired|Chrome link|already been used/i.test(t)?n:t};const n='That sign-in link has run out or has already been used. On your phone, open More, then Use on a computer, and make a new one.';const t=n=>(n.match(/.{1,4}/g)??[]).join(' ')},1451,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LaunchWelcome=function({p:e,onDone:t}){(0,r.useEffect)(()=>{if(!O||document.getElementById('cc-launch-css'))return;const e=document.createElement('style');e.id='cc-launch-css',e.textContent=I,document.head.appendChild(e)},[]),(0,r.useEffect)(()=>{if(O)return document.documentElement.classList.add('cc-welcome'),()=>document.documentElement.classList.remove('cc-welcome')},[]);const[o,k]=(0,r.useState)(P()?0:3),[E,_]=(0,r.useState)('main'),[Y,F]=(0,r.useState)(''),[H,M]=(0,r.useState)(0);(0,r.useEffect)(()=>{if(o<=0)return;const e=setTimeout(()=>k(e=>e-1),300);return()=>clearTimeout(e)},[o]);const B=(0,f.useAvatars)(t=>!!t.photos[e.id]),K=(0,b.useStore)(e=>e.restaurants[0]?.name??'Your venue').toUpperCase(),V=(0,x.useOwner)(t=>t.hourly[e.id]),G=(0,x.useOwner)(t=>t.staff.find(t=>t.id===e.id)),$=(0,y.useSync)(e=>e.mode),J='live'===$||'offline'===$,q=G?.salaried||e.salaried?'Salaried':null!=V?`\xa3${(V/100).toFixed(2)} an hour${G?.noTax?' \xb7 no-tax code':''}`:'connecting'===$?'Loading\u2026':'Ask your manager',Q='staff'!==e.app&&'staff'!==p.APP_VARIANT?(0,v.appUrl)('staff'):null,X=`AN-${String(j.ROSTER.findIndex(t=>t.id===e.id)+1).padStart(2,'0')}`,Z=p.IS_OWNER_DESKTOP?'CoverCharge for desktop':v.APP_NAME['staff'===p.APP_VARIANT?'staff':e.app],ee=L['staff'===p.APP_VARIANT&&'staff'!==e.app?'Staff':e.level]??L.Staff;return(0,C.jsxs)(h.default,{testID:"invite-welcome",style:[u.default.absoluteFill,{backgroundColor:(0,n.soutersSurface)('#000'),zIndex:1e3}],children:[(0,C.jsxs)(h.default,{...R('space'),pointerEvents:"none",children:[(0,C.jsx)(h.default,{...R('stars1')}),(0,C.jsx)(h.default,{...R('stars2')})]}),o>0?(0,C.jsxs)(l.default,{testID:"invite-countdown",accessibilityLabel:"Skip intro",onPress:()=>k(0),style:{flex:1,alignItems:'center',justifyContent:'center',gap:10},children:[(0,C.jsxs)(D,{colour:w.colours.muted,children:[K," \xb7 COVER CHARGE"]}),(0,C.jsx)(h.default,{...R('count'),children:(0,C.jsx)(T.T,{size:120,weight:"bold",colour:A,children:o})},o),(0,C.jsx)(D,{children:"GETTING YOU ON BOARD"})]}):'selfie'===E?(0,C.jsx)(W,{p:e,onClose:e=>{_('main'),e?(F('Avatar saved. Looking good!'),M(e=>e+1)):F('')}}):(0,C.jsxs)(c.default,{contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsxs)(h.default,{...R('rise1'),style:{alignItems:'center',gap:2},children:[(0,C.jsxs)(D,{children:[K," \xb7 ",Z.toUpperCase()]}),(0,C.jsx)(T.T,{size:20,colour:w.colours.muted,center:!0,style:{marginTop:10},children:"Welcome aboard,"}),(0,C.jsx)(T.T,{size:42,weight:"bold",center:!0,style:{lineHeight:50},children:e.name})]}),(0,C.jsxs)(h.default,{...R('reveal'),style:{marginVertical:8},children:[(0,C.jsx)(h.default,{...R('orbit'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:156})})]},H),Y?(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:w.colours.ok,center:!0,children:Y}):null,(0,C.jsx)(h.default,{...R('rise2'),style:{alignSelf:'stretch'},children:(0,C.jsxs)(h.default,{testID:"invite-crew-card",...R('card'),style:{borderRadius:20,borderWidth:1,borderColor:'rgba(207,164,95,0.55)',overflow:'hidden',padding:18,gap:12},children:[(0,C.jsx)(h.default,{...R('sheen'),pointerEvents:"none"}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:[(0,C.jsx)(D,{children:"CREW ID"}),(0,C.jsx)(T.T,{size:15,weight:"semibold",colour:w.colours.muted,style:{letterSpacing:1.5},children:X})]}),(0,C.jsx)(h.default,{style:{height:2,backgroundColor:A,opacity:.7,borderRadius:1}}),(0,C.jsx)(N,{k:"NAME",v:e.name}),(0,C.jsx)(N,{k:"ROLE",v:(0,v.levelJob)(e.level,e.job)}),(0,C.jsx)(N,{k:"APP",v:Z}),'owner'!==e.role?(0,C.jsx)(h.default,{testID:"invite-pay",children:(0,C.jsx)(N,{k:"PAY",v:q})}):null,(0,C.jsx)(N,{k:"ACCESS",v:'Owner'===e.level?'Everything':'Manager'===e.level?'Manager':'Supervisor'===e.level?'Supervisor':'Head Chef'===e.level?'Kitchen lead':'Team member'}),(0,C.jsxs)(h.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,C.jsx)(h.default,{...R('blink'),style:{width:10,height:10,borderRadius:5,backgroundColor:w.colours.ok}}),(0,C.jsx)(T.T,{size:15,colour:w.colours.ok,children:p.IS_OWNER_DESKTOP?'Signed in on this computer':'Signed in on this phone'})]})]})}),(0,C.jsxs)(h.default,{...R('rise3'),style:{alignSelf:'stretch',gap:10},children:[(0,C.jsx)(D,{children:"WHAT YOU CAN DO"}),ee.map(e=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'flex-start'},children:[(0,C.jsx)(T.T,{size:16,colour:A,children:"\u25c6"}),(0,C.jsx)(T.T,{size:16,style:{flex:1},children:e})]},e))]}),O?(0,C.jsxs)(h.default,{testID:"invite-avatar-offer",...R('rise4'),style:{alignSelf:'stretch',gap:12,borderRadius:20,padding:18,borderWidth:1,borderColor:'rgba(255,255,255,0.14)',backgroundColor:'rgba(255,255,255,0.03)'},children:[(0,C.jsx)(D,{children:"YOUR AVATAR \xb7 OPTIONAL"}),(0,C.jsx)(T.T,{size:16,children:B?'You made your own avatar from a photo.':'Keep this one, choose an original icon, or make your own from a photo.'}),(0,C.jsx)(z,{kind:"ghost",label:B?'Choose another avatar':'Choose my avatar',testID:"invite-avatar-make",onPress:()=>{F(''),_('selfie')}}),(0,C.jsxs)(T.T,{size:15,colour:w.colours.muted,children:["Your photo stays on this ",p.IS_OWNER_DESKTOP?'computer':'phone',". It\u2019s turned into your avatar here; only the finished avatar is shared with your team."]})]}):null,(0,C.jsx)(h.default,{style:{alignSelf:'stretch',gap:10,marginTop:4},children:(0,C.jsx)(z,{label:B?'Get started':'Skip, keep this one and get started',testID:"invite-get-started",onPress:t})}),(0,s.inPhoneApp)()?null:(0,C.jsxs)(h.default,{style:{alignSelf:'stretch',gap:6,borderRadius:16,padding:16,borderWidth:1,borderColor:'rgba(255,255,255,0.12)'},children:[(0,C.jsx)(T.T,{size:16,weight:"semibold",colour:A,children:"Tip: add it to your Home screen"}),(0,C.jsxs)(T.T,{size:15,children:[U()," It then opens like a normal app and remembers you."]})]}),Q?(0,C.jsx)(l.default,{accessibilityRole:"link",onPress:()=>{O&&window.location.assign(Q)},children:(0,C.jsx)(T.T,{size:15,colour:A,center:!0,children:"Also open CoverCharge for Staff (your clock-in, rota and pay) \u203a"})}):null,(0,C.jsx)(T.T,{size:14,colour:w.colours.muted,center:!0,children:J?'Connected: bookings, orders and stock are shared live with the rest of the team. Your pay is only visible to you and your managers.':'Connecting\u2026 if there\u2019s no signal, what you enter is kept on this phone and shared once you\u2019re back online.'})]})]})};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),s=_r(d[3]),o=e(_r(d[4]));_r(d[5]);var l=e(_r(d[6])),c=e(_r(d[7])),u=e(_r(d[8])),h=e(_r(d[9])),p=_r(d[10]),f=_r(d[11]),x=_r(d[12]),b=_r(d[13]),y=_r(d[14]),v=_r(d[15]),j=_r(d[16]),k=_r(d[17]),w=_r(d[18]),S=_r(d[19]),T=_r(d[20]),C=_r(d[21]);const A=w.colours.gold,I="\n[data-cc=\"space\"]{position:absolute;top:0;left:0;right:0;bottom:0;overflow:hidden;background:radial-gradient(ellipse at 50% 115%,#2a1f0c 0%,#0a0805 38%,#000 70%)}\n[data-cc=\"stars1\"],[data-cc=\"stars2\"]{position:absolute;top:-50%;left:-50%;width:200%;height:200%;will-change:transform}\n[data-cc=\"stars1\"]{background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.2px 1.2px at 183px 77px,#fff8,transparent);background-size:211px 199px;animation:cc-drift 90s linear infinite;opacity:.75}\n[data-cc=\"stars2\"]{background-image:radial-gradient(2px 2px at 40px 60px,#CFA45F,transparent),radial-gradient(1.6px 1.6px at 250px 210px,#fff,transparent),radial-gradient(1.8px 1.8px at 330px 40px,#fffc,transparent);background-size:397px 367px;animation:cc-drift2 60s linear infinite,cc-twinkle 3.2s ease-in-out infinite alternate;opacity:.8}\n@keyframes cc-drift{to{transform:translate3d(-211px,199px,0)}}\n@keyframes cc-drift2{to{transform:translate3d(-397px,367px,0)}}\n@keyframes cc-twinkle{from{opacity:.45}to{opacity:.95}}\n[data-cc=\"count\"]{animation:cc-count .32s cubic-bezier(.2,.8,.2,1) both}\n@keyframes cc-count{from{opacity:0;transform:scale(1.9)}to{opacity:1;transform:scale(1)}}\n[data-cc=\"reveal\"]{animation:cc-reveal .75s cubic-bezier(.2,.9,.25,1.25) both}\n@keyframes cc-reveal{0%{opacity:0;transform:scale(.35) rotate(-12deg)}100%{opacity:1;transform:scale(1) rotate(0)}}\n[data-cc=\"halo\"]{border-radius:999px;box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 38px 6px rgba(207,164,95,.35);animation:cc-glow 2.6s ease-in-out infinite}\n@keyframes cc-glow{0%,100%{box-shadow:0 0 0 2px rgba(207,164,95,.85),0 0 30px 4px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 2px rgba(207,164,95,1),0 0 52px 10px rgba(207,164,95,.5)}}\n[data-cc=\"orbit\"]{position:absolute;top:-14px;left:-14px;right:-14px;bottom:-14px;border-radius:999px;border:1px dashed rgba(207,164,95,.45);animation:cc-spin 14s linear infinite}\n@keyframes cc-spin{to{transform:rotate(360deg)}}\n[data-cc=\"rise1\"],[data-cc=\"rise2\"],[data-cc=\"rise3\"],[data-cc=\"rise4\"]{animation:cc-rise .5s cubic-bezier(.2,.8,.2,1) both}\n[data-cc=\"rise2\"]{animation-delay:.12s}[data-cc=\"rise3\"]{animation-delay:.24s}[data-cc=\"rise4\"]{animation-delay:.36s}\n@keyframes cc-rise{from{opacity:0;transform:translate3d(0,18px,0)}to{opacity:1;transform:none}}\n[data-cc=\"btn\"]{transition:transform .12s ease,box-shadow .2s ease,filter .2s ease;cursor:pointer}\n[data-cc=\"btn\"]:hover{filter:brightness(1.08)}\n[data-cc=\"btnp\"]{transition:transform .12s ease,box-shadow .2s ease;cursor:pointer;box-shadow:0 0 0 1px rgba(207,164,95,.9),0 8px 30px rgba(207,164,95,.35)}\n[data-cc=\"btnp\"]:hover{box-shadow:0 0 0 1px #CFA45F,0 8px 44px rgba(207,164,95,.6)}\n[data-cc=\"card\"]{background:linear-gradient(135deg,rgba(255,255,255,.07),rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}\n[data-cc=\"sheen\"]{position:absolute;top:0;bottom:0;width:40%;left:-60%;background:linear-gradient(100deg,transparent,rgba(255,255,255,.10),transparent);animation:cc-sheen 3.8s ease-in-out 1s infinite}\n@keyframes cc-sheen{0%{left:-60%}35%,100%{left:130%}}\n[data-cc=\"scan\"]{position:absolute;left:0;right:0;height:4px;background:linear-gradient(90deg,transparent,#CFA45F,#fff,#CFA45F,transparent);box-shadow:0 0 18px 4px rgba(207,164,95,.75);animation:cc-scan .9s ease-in-out infinite alternate}\n@keyframes cc-scan{from{top:2%}to{top:96%}}\n[data-cc=\"grid\"]{position:absolute;top:0;left:0;right:0;bottom:0;background-image:linear-gradient(rgba(207,164,95,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(207,164,95,.18) 1px,transparent 1px);background-size:22px 22px}\n[data-cc=\"blink\"]{animation:cc-blink 1s steps(2,start) infinite}\n@keyframes cc-blink{to{visibility:hidden}}\nhtml.cc-welcome #cc-install-hint{display:none !important}\n@media (prefers-reduced-motion: reduce){[data-cc]{animation:none !important;transition:none !important}}\n",R=e=>({dataSet:{cc:e}}),O='undefined'!=typeof document,P=()=>O&&'function'==typeof window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches,E=()=>{try{O&&navigator.vibrate?.(12)}catch{}};function z({label:e,onPress:t,kind:n="primary",testID:r,disabled:s}){const o='primary'===n;return(0,C.jsx)(l.default,{testID:r,accessibilityRole:"button",accessibilityLabel:e,disabled:s,onPress:()=>{E(),t()},...R(o&&!s?'btnp':'btn'),style:({pressed:e})=>[{alignSelf:'stretch',minHeight:56,borderRadius:28,alignItems:'center',justifyContent:'center',paddingHorizontal:20,backgroundColor:o?A:'rgba(255,255,255,0.04)',borderWidth:o?0:1.5,borderColor:A,opacity:s?.45:1,transform:[{scale:e?.96:1}]}],children:(0,C.jsx)(T.T,{size:18,weight:"semibold",colour:o?'#0B0B0B':A,center:!0,children:e})})}const D=({children:e,colour:t=A})=>(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:t,style:{letterSpacing:2.2},children:e}),L={Owner:['Takings, sales, labour cost and payroll','Bookings (Tables and Covers), orders, the rota and team chat','Every setting'],Manager:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],Supervisor:['Run service: orders, bookings (Tables and Covers) and the waitlist','The rota, timesheets and team pay rates','Your own clock-in and pay in the Staff app'],'Head Chef':['Stock, costings, prep, ordering and the specials board','Food safety checks, allergens and live tickets','Your own clock-in, rota and pay in the Staff app'],Staff:['Clock in and out, see your rota, swap shifts, ask for time off','Team chat, food safety checks and the accident book','Your own hours, pay and tips (only yours)']};function U(){const e=O?navigator.userAgent:'';return/iPhone|iPad|iPod/.test(e)?'In Safari, tap Share (the square with an arrow), then Add to Home Screen.':/SamsungBrowser/.test(e)?'Tap the menu, then Add page to, then Home screen.':'In Chrome, tap \u22ee then Add to Home screen (or Install app).'}const N=({k:e,v:t})=>(0,C.jsxs)(h.default,{style:{flexDirection:'row',gap:12,alignItems:'baseline'},children:[(0,C.jsx)(T.T,{size:14,weight:"semibold",colour:w.colours.muted,numberOfLines:1,style:{width:74,letterSpacing:1.2},children:e}),(0,C.jsx)(T.T,{size:18,weight:"semibold",style:{flex:1},children:t})]});function W({p:e,onClose:s}){const[u,x]=(0,r.useState)('choose'),[b,y]=(0,r.useState)(null),[v,j]=(0,r.useState)(null),[I,O]=(0,r.useState)(!1),[L,U]=(0,r.useState)(''),N=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{N.current&&URL.revokeObjectURL(N.current)},[]);const W=async e=>{U('');const t=await(0,k.pickPhoto)(e);if(!t)return;N.current&&URL.revokeObjectURL(N.current);const n=URL.createObjectURL(t);N.current=n,y(n),O(!1),x('scan');const r=Date.now();try{const e=await(0,k.styliseOnDevice)(t),n=P()?0:Math.max(0,1300-(Date.now()-r));setTimeout(()=>{j(e),x('reveal'),E()},n)}catch{U("That photo couldn't be opened. Try another one (JPEG or PNG)."),x('choose')}},_=({children:e})=>(0,C.jsx)(h.default,{style:{width:236,height:236,borderRadius:118,overflow:'hidden',borderWidth:2,borderColor:A,alignItems:'center',justifyContent:'center',backgroundColor:(0,n.soutersSurface)('#050505')},children:e});return(0,C.jsxs)(c.default,{testID:"invite-avatar-step",contentContainerStyle:{padding:22,paddingTop:34,gap:18,alignItems:'center',maxWidth:520,width:'100%',alignSelf:'center',paddingBottom:56},children:[(0,C.jsx)(D,{children:"MAKE YOUR AVATAR"}),(0,C.jsx)(T.T,{size:28,weight:"bold",center:!0,children:'choose'===u?'Choose your look':'scan'===u?'Scanning\u2026':`Looking good, ${e.name}`}),'choose'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[(0,C.jsx)(h.default,{style:{opacity:.55},children:(0,C.jsx)(S.StaffAvatar,{id:e.id,size:200,ring:!1})}),(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"})]})})}),(0,C.jsxs)(T.T,{size:16,center:!0,colour:w.colours.muted,children:["Take a selfie or pick a photo. ",p.IS_OWNER_DESKTOP?'This computer turns it into a space-age avatar. The photo never leaves this computer and isn\u2019t kept.':'Your phone turns it into a space-age avatar. The photo never leaves this phone and isn\u2019t kept.']}),(0,C.jsx)(z,{label:"Take a selfie",testID:"avatar-selfie",onPress:()=>W(!0)}),(0,C.jsx)(z,{kind:"ghost",label:"Upload a photo",testID:"avatar-upload",onPress:()=>W(!1)}),(0,C.jsx)(h.default,{style:{width:'100%',minWidth:0},children:(0,C.jsx)(t.AvatarOptions,{onSelect:t=>{f.useAvatars.getState().setOwn(e.id,e.id,t.dataUrl,e.name)?s(!0):U('Could not save your avatar. Try again.')}})})]}):'scan'===u?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('halo'),children:(0,C.jsxs)(_,{children:[b?(0,C.jsx)(o.default,{source:{uri:b},style:{width:236,height:236},accessibilityLabel:"Your photo"}):null,(0,C.jsx)(h.default,{...R('grid'),pointerEvents:"none"}),(0,C.jsx)(h.default,{...R('scan'),pointerEvents:"none"})]})}),(0,C.jsx)(D,{colour:w.colours.muted,children:"MAKING YOUR AVATAR ON THIS PHONE"})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.default,{...R('reveal'),children:(0,C.jsx)(h.default,{...R('halo'),children:v?(0,C.jsx)(o.default,{testID:"avatar-result",source:{uri:v},style:{width:220,height:220,borderRadius:110},accessibilityLabel:"Your new avatar"}):null})}),(0,C.jsxs)(l.default,{accessibilityRole:"checkbox",accessibilityState:{checked:I},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>{E(),O(!I)},style:{alignSelf:'stretch',flexDirection:'row',gap:12,alignItems:'flex-start',padding:14,borderRadius:16,borderWidth:1.5,borderColor:I?A:'rgba(255,255,255,0.2)'},children:[(0,C.jsx)(h.default,{style:{width:28,height:28,borderRadius:8,borderWidth:2,borderColor:A,backgroundColor:I?A:'transparent',alignItems:'center',justifyContent:'center'},children:I?(0,C.jsx)(T.T,{size:17,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,C.jsx)(T.T,{size:15,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,C.jsx)(z,{label:"Use this avatar",testID:"avatar-save",disabled:!I,onPress:()=>{if(!v)return;f.useAvatars.getState().setOwn(e.id,e.id,v,e.name)?(N.current&&URL.revokeObjectURL(N.current),N.current=null,s(!0)):U("Couldn't save the avatar. Please try again.")}}),(0,C.jsx)(z,{kind:"ghost",label:"Try another photo",onPress:()=>{j(null),x('choose')}})]}),L?(0,C.jsx)(T.T,{size:15,colour:w.colours.red,center:!0,children:L}):null,'scan'!==u?(0,C.jsx)(l.default,{testID:"invite-avatar-done",accessibilityRole:"button",onPress:()=>{E(),s(!1)},style:({pressed:e})=>({padding:12,transform:[{scale:e?.96:1}]}),children:(0,C.jsx)(T.T,{size:17,weight:"semibold",colour:w.colours.text,children:"Skip, keep this one"})}):null]})}},1452,[888,813,17,1069,319,219,385,278,24,85,856,885,876,816,899,920,878,776,804,884,777,8]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const N=(0,y.useInStaffApp)(),{now:R,meId:z,me:H,r:P,today:F}=(0,y.useCtx)(3e4),_=(0,x.useSeatClearFinish)(),E=(0,s.useTravelDay)('staff',F),W=(0,h.useOwner)(e=>e.shifts),q=(0,h.useOwner)(e=>(0,h.liveAttendance)(e.attendance)),V=(0,h.useOwner)(e=>e.staffCanViewSuppliers),G=(0,h.useOwner)(e=>e.quickLinks),U=(0,h.useOwner)(e=>e.chat),Y=(0,h.useOwner)(e=>e.swaps),Q=(0,h.useOwner)(e=>e.leave),K=(0,O.workingShifts)(W,Q).filter(e=>e.staffId===z&&e.published&&e.date>=F).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),J=K.find(e=>e.date===F),X=q.filter(e=>e.staffId===z&&e.in&&!e.out&&R.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],Z=(0,j.usePay)(z,0),ee=(0,w.useOrders)(P.id),se=(0,w.useBookings)(P.id),te=ee.filter(e=>(0,C.LIVE)(e)&&e.allergies.length&&(0,S.nextStep)(e,(0,S.linkedBooking)(e,se))),ae=se.filter(e=>e.date===F&&['confirmed','seated'].includes(e.status)&&(0,S.bookingNeedsAction)(e,ee.filter(C.LIVE))),ie=se.filter(e=>(0,D.undoKind)(e,F)||e.walkIn&&'cancelled'===e.status&&e.date===F).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),le=U.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],ne=Y.filter(e=>e.fromId===z&&'open'===e.status).length+Q.filter(e=>e.staffId===z&&'pending'===e.status).length,de=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & time off',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...V?[['Suppliers',()=>e('more','suppliers')]]:[]];return!N&&E?(0,L.jsxs)(o.default,{style:{gap:10},children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(s.DayView,{rid:P.id,day:E,today:F,app:"staff"})]}):(0,L.jsxs)(o.default,{style:{gap:10},children:[N?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s.DayBar,{app:"staff",today:F}),(0,L.jsx)(t.CoversToday,{rid:P.id})]}),(0,L.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,L.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,L.jsx)(I.StaffAvatar,{id:z,size:52})}),(0,L.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",H.replace(' (example)','').split(' ')[0]]})]}),(0,L.jsx)(r.Badge,{kind:"gold",label:N?P.name:'Staff app preview'})]}),(0,L.jsx)(r.Muted,{children:N?`${R.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,L.jsx)(M.StaffTipsTile,{rid:P.id,today:F,onPress:()=>e('more','mytips')}),(0,L.jsxs)(r.Card,{highlight:X?u.colours.ok:void 0,children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{weight:"semibold",children:X?`On shift since ${(0,c.hm)(new Date(X.in))}`:'Not clocked in'}),X?(0,L.jsx)(r.Badge,{kind:"ok",label:(0,y.hmDur)(Math.max(0,Math.round((R.getTime()-new Date(X.in).getTime())/6e4)))}):null]}),J?(0,L.jsxs)(r.Muted,{children:["Today on the rota: ",(0,y.fmtH)(J.start),"\u2013",(0,y.fmtH)(J.end),(0,m.cleanBadge)(J.badge)?` \xb7 ${(0,m.cleanBadge)(J.badge)}`:'']}):K[0]?(0,L.jsxs)(r.Muted,{children:["Next on the rota: ",y.DAY3[K[0].day]," ",Number(K[0].date.slice(8))," ",(0,y.fmtH)(K[0].start),"\u2013",(0,y.fmtH)(K[0].end),(0,m.cleanBadge)(K[0].badge)?` \xb7 ${(0,m.cleanBadge)(K[0].badge)}`:'']}):(0,L.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,L.jsx)(r.Button,{small:!0,kind:X?'secondary':'success',label:X?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),z?(0,L.jsx)(v.RequestTimeOff,{meId:z,me:H,testID:"staff-home-time-off"}):null,(0,L.jsx)(p.ShellfishTile,{rid:P.id,by:H.replace(' (example)',''),app:"staff",readOnly:!_.ok}),ie.length?(0,L.jsx)(r.Card,{children:(0,L.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,L.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",ie.length,")"]}),(0,L.jsx)(r.Muted,{children:_.ok?'Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo.':'Today\u2019s seated and finished parties. Ask a manager to change a booking or cancel a walk-in.'}),ie.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,L.jsxs)(o.default,{testID:(0,f.isSeatedHighlight)(e.status)?`staff-seated-row-${e.id}`:`staff-done-row-${e.id}`,style:(0,f.isSeatedHighlight)(e.status)?{gap:6,padding:10,borderRadius:12,marginTop:4,...(0,f.seatedHighlightStyle)()}:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8,opacity:'finished'===e.status||'noshow'===e.status?.7:1},children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsxs)(r.T,{size:17,weight:"semibold",colour:(0,f.isSeatedHighlight)(e.status)?f.SEATED_FG:u.colours.text,children:[e.time," \xb7 ",s]}),(0,L.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,L.jsxs)(r.Muted,{children:[e.table?(0,B.tableCardLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,L.jsx)(A.FinishButton,{rid:P.id,b:e,name:s,allowed:_.ok,hint:_.hint,small:!0,testID:`staff-finish-${e.id}`}):null,e.walkIn?(0,L.jsx)(a.CancelWalkInButton,{rid:P.id,b:e,small:!0}):null,e.walkIn?(0,L.jsx)(a.ReinstateWalkInButton,{rid:P.id,b:e,today:F,small:!0}):null,(0,L.jsx)(D.BookingUndo,{b:e,rid:P.id,today:F,who:s,allowed:_.ok})]})]},e.id)})]})}):null,te.length+ae.length?(0,L.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,L.jsx)(r.T,{weight:"semibold",children:_.ok?`Allergy sign-offs (${te.length+ae.length})`:`Allergies today (${te.length+ae.length})`}),(0,L.jsx)(r.Muted,{children:_.ok?'Tap Sign off for your step. Your name and the time are recorded.':'Allergy notes for today. Ask a manager to sign off a step.'}),te.map(e=>(0,L.jsx)(k.AllergyChain,{o:e,me:H,readOnly:!_.ok},e.id)),ae.map(e=>(0,L.jsxs)(o.default,{accessible:!0,accessibilityLabel:`Booking ${e.time}, ${e.name}, ${e.partySize}${e.table?`, ${(0,$.tableNumbersA11y)(e.table)}`:''}`,style:{gap:4},children:[(0,L.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,B.tablesLabel)(e.table)}`:'']}),(0,L.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,L.jsx)(k.BookingAllergyChain,{b:e,me:H,readOnly:!_.ok}),_.ok?(0,L.jsx)(o.default,{style:{flexDirection:'row'},children:(0,L.jsx)(T.WhatsAppGuest,{b:e,rid:P.id,kind:"auto"})}):null]},e.id))]}):null,le?(0,L.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,L.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,L.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,L.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,L.jsx)(r.T,{size:14,children:le.text})]}):null,(0,L.jsxs)(r.Card,{children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,L.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,y.hmDur)(Z.paid)," paid hours"]})]}),ne?(0,L.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,L.jsxs)(r.T,{size:14,children:["You have ",ne," request",ne>1?'s':''," waiting for a manager \u203a"]})}):null,(0,b.visibleLinks)(G,'staff').length?(0,L.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,L.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,L.jsx)(b.QuickLinksRow,{compact:!0})]}):null,N?null:(0,L.jsx)(o.default,{style:{gap:6},children:de.map(([e,s])=>(0,L.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),y=_r(d[14]),x=_r(d[15]),j=_r(d[16]),b=_r(d[17]),k=_r(d[18]),w=_r(d[19]),T=_r(d[20]),S=_r(d[21]),C=_r(d[22]),I=_r(d[23]),D=_r(d[24]),B=_r(d[25]),$=_r(d[26]),A=_r(d[27]),M=_r(d[28]),v=_r(d[29]),O=_r(d[30]),L=_r(d[31])},1453,[1179,1072,1117,1089,17,385,85,777,876,863,804,1090,1171,1168,1057,1120,1176,1441,1162,860,1180,853,1178,884,1355,998,843,1115,1193,1200,1071,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},1454,[13,17,856,8]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return q}});var s=r(_d[0]),t=r(_d[1]);r(_d[2]),r(_d[3]);var n=r(_d[4]),o=r(_d[5]),u=r(_d[6]),l=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(r(_d[7])),c=r(_d[8]),d=r(_d[9]),f=e(r(_d[10])),p=e(r(_d[11]));r(_d[12]);var y=e(r(_d[13])),h=e(r(_d[14])),S=r(_d[15]),O=r(_d[16]),P=r(_d[17]),_=r(_d[18]),j=r(_d[19]),v=r(_d[20]),b=r(_d[21]),A=r(_d[22]),x=r(_d[23]),w=r(_d[24]),E=r(_d[25]),C=r(_d[26]),k=r(_d[27]);r(_d[28]);var I=r(_d[29]),R=r(_d[30]),T=r(_d[31]),H=r(_d[32]),F=r(_d[33]),B=r(_d[34]),V=r(_d[35]),N=r(_d[36]),G=r(_d[37]);const L=r(_d[38]),M=r(_d[39]),D=r(_d[40]),U=r(_d[41]);function q(){const[e]=(0,n.useFonts)({Poppins_400Regular:L,Poppins_500Medium:M,Poppins_600SemiBold:D,Poppins_700Bold:U}),[s,C]=(0,d.useState)(b.useStore.persist.hasHydrated()),[H,F]=(0,d.useState)(x.useOwner.persist.hasHydrated()),B=s&&H;(0,d.useEffect)(()=>{const e=b.useStore.persist.onFinishHydration(()=>C(!0)),s=x.useOwner.persist.onFinishHydration(()=>F(!0));return b.useStore.persist.hasHydrated()&&C(!0),x.useOwner.persist.hasHydrated()&&F(!0),()=>{e(),s()}},[]),(0,d.useEffect)(()=>{if('undefined'==typeof window)return;const e=e=>{e.key===(0,S.venueKey)(b.useStore.persist.getOptions().name??'')&&(0,k.quietly)(()=>b.useStore.persist.rehydrate()),e.key===(0,S.venueKey)(A.useFloor.persist.getOptions().name??'')&&(0,k.quietly)(()=>A.useFloor.persist.rehydrate()),e.key===(0,S.venueKey)(o.useBlocks.persist.getOptions().name??'')&&(0,k.quietly)(()=>o.useBlocks.persist.rehydrate())};return window.addEventListener('storage',e),()=>window.removeEventListener('storage',e)},[]),(0,d.useEffect)(()=>{B&&x.useOwner.getState().syncRoster()},[B]),(0,d.useEffect)(()=>{B&&(0,t.startAppSync)()},[B]);const V=e&&B,N=(0,E.useSignedOutGate)(),q=(0,u.usePathname)(),K=V&&!(0,_.isAllowedPath)(q||'/');return(0,d.useEffect)(()=>{if(!K)return;const e=setTimeout(()=>u.router.replace(_.ENTRY[_.APP_VARIANT]),0);return()=>clearTimeout(e)},[K,q]),(0,d.useEffect)(()=>{V&&l.hideAsync().catch(()=>{})},[V]),V?(0,G.jsxs)(v.SafeAreaProvider,{children:[(0,G.jsx)(c.StatusBar,{style:"light"}),N?(0,G.jsx)(h.default,{style:{flex:1,backgroundColor:w.colours.bg}}):(0,G.jsx)(h.default,{style:{flex:1},children:(0,G.jsx)(u.Stack,{screenOptions:{headerShown:!1,contentStyle:{backgroundColor:w.colours.bg}}})}),K&&!N?(0,G.jsx)(h.default,{style:[y.default.absoluteFill,{backgroundColor:w.colours.bg}]}):null,N?null:(0,G.jsx)(I.SyncBadge,{}),K||N||_.IS_CAR?null:(0,G.jsx)(R.PushPrompt,{}),_.IS_CAR?(0,G.jsx)(j.CarGate,{}):(0,G.jsx)(E.InviteGate,{}),(0,G.jsx)(P.BackToDisplay,{}),K||N?null:(0,G.jsx)(T.SliderHost,{})]}):(0,G.jsxs)(h.default,{style:{flex:1,backgroundColor:w.colours.bg,alignItems:'center',justifyContent:'center',gap:18},children:[O.HERO_LOGOS[S.VENUE_RID]?(0,G.jsx)(p.default,{source:O.HERO_LOGOS[S.VENUE_RID],accessibilityLabel:"Venue logo",style:{width:180,height:180},resizeMode:"contain"}):null,(0,G.jsx)(f.default,{color:w.colours.gold})]})}H.PITCH&&(globalThis.__pitch={useSaverCfg:N.useSaverCfg,useSync:t.useSync,seedInvitePairsForQA:s.seedInvitePairsForQA,appVariant:_.APP_VARIANT,useStore:b.useStore,useOwner:x.useOwner,useFloor:A.useFloor,useBlocks:o.useBlocks,useSession:C.useSession,useCashUp:F.useCashUp,useCashAccess:B.useCashAccess,seedPitch:V.seedPitch},setTimeout(()=>{try{(0,V.seedPitch)()}catch(e){console.warn('pitch seed',e)}},1500)),C.START_INVITE,l.preventAutoHideAsync().catch(()=>{})},1455,[1456,899,778,1408,1458,995,13,1485,479,17,368,319,219,24,85,805,857,1065,856,1487,19,858,998,876,804,1448,920,988,1490,1491,1028,1104,880,1008,914,1493,1378,8,1494,1495,1496,1497]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteCache",{enumerable:!0,get:function(){return S}}),_e.refreshLinkPhones=P,_e.linkedSinceText=L,_e.refreshInvites=A,_e.useInviteStatus=function(){const[,e]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const n=()=>e(e=>e+1);return $.add(n),A(),()=>{$.delete(n)}},[]),j},Object.defineProperty(_e,"when",{enumerable:!0,get:function(){return C}}),_e.inviteStateText=function(e,n=Date.now()){return'used'===e?.state?'Previous link used. Make a new link only if they need one.':e?.devices?`Signed in on ${e.devices} device${1===e.devices?'':'s'}`:'Personal Android and iPhone links'},_e.seedInvitePairsForQA=function(n,t,s){if(!e.PITCH)throw new Error('QA only');w.set(`${n}:${t}`,{working:[s.android,s.iphone].filter(Boolean).length,...s}),x()},Object.defineProperty(_e,"installSteps",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"installMessage",{enumerable:!0,get:function(){return R}}),_e.InviteLinkControls=function({m:e,actorRole:s}){const o=(0,h.useSync)(e=>e.venueId),x=(0,h.useSync)(e=>'staff'===e.kind&&!!e.venueId),j=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),S=x&&e.active&&!e.name.includes('(example)')&&('owner'===s||j||'manager'===s&&'owner'!==e.role&&!e.ownerAccess),A=`${o}:${e.id}`,O=(0,k.useSession)(e=>e.meId),E=(0,y.useOwner)(e=>O?e.staff.find(e=>e.id===O):void 0),W=!O||!!E&&(0,f.ownJobManagesLinks)(E),[,_]=(0,t.useState)(0),[F,Y]=(0,t.useState)(''),[Z,N]=(0,t.useState)(null),[U,G]=(0,t.useState)(!1),[Q,q]=(0,t.useState)(null),[J,K]=(0,t.useState)(null),[V,X]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{if(!S)return;const n=()=>_(e=>e+1);return $.add(n),P(),M(A,e.id),()=>{$.delete(n)}},[S,A,e.id]),!S)return null;const ee=w.get(A),ne=e.name.split(' ')[0],te=['android','iphone'].filter(e=>T(ee?.[e])),ie=ee?.working??te.length,se=!0===ee?.oldLinksSwitchOff?'Their old link switches off once they open this one.':'Their other links keep working.',ae=async n=>{try{await(0,h.revokeStaffAppLink)(n),K(null),Y('Link switched off. Phones already signed in stay signed in.'),b.delete(A),await M(A,e.id),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}},re=async n=>{if(!Z){N(n);try{await D(A,e.id,n),G(!1),Y(`New ${'android'===n?'Android':'iPhone'} link made for ${ne}. ${se} Copy or Share it below.`),Q&&q(await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}finally{N(null)}}};return(0,m.jsxs)(l.default,{testID:`invite-${e.id}`,style:{gap:10},children:[(()=>{const n=L(I[e.id]);return n?(0,m.jsxs)(l.default,{testID:`invite-phone-${e.id}`,style:{gap:8,padding:12,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",colour:u.colours.goldLight,testID:`invite-phone-since-${e.id}`,children:n}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Another phone that opens ",e.name,"\u2019s link is asked to see a manager."]}),W?V?(0,m.jsxs)(l.default,{style:{gap:8,alignItems:'center',width:'100%'},children:[(0,m.jsxs)(d.T,{center:!0,size:15,children:["Reset ",e.name,"\u2019s phone? Their link will link to the next phone that opens it. Phones already signed in stay signed in."]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Yes, reset phone",testID:`invite-reset-yes-${e.id}`,style:{minHeight:44},accessibilityLabel:`Yes, reset ${e.name}'s phone`,onPress:async()=>{try{await(0,h.resetStaffLinkPhone)(e.id),await P(),Y(`Phone reset. ${e.name}\u2019s link will link to the next phone that opens it.`)}catch(e){Y(String(e.message))}finally{X(!1)}}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},testID:`invite-reset-no-${e.id}`,onPress:()=>X(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Reset phone",kind:"secondary",testID:`invite-reset-${e.id}`,style:{minHeight:44},accessibilityLabel:`Reset phone for ${e.name}. Asks to confirm.`,onPress:()=>X(!0)}):(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-reset-managers-only-${e.id}`,children:"Only a manager or owner can reset a phone or switch a link off."})]}):null})(),ee?null:(0,m.jsx)(d.Muted,{center:!0,testID:`invite-loading-${e.id}`,children:v.has(A)?'Cannot load the links right now. Close and open again to retry.':'Loading current links\u2026'}),ee&&0===ie?(0,m.jsxs)(l.default,{testID:`invite-none-${e.id}`,style:{gap:6,padding:12,borderRadius:10,borderWidth:2,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",size:17,accessibilityRole:"header",children:"No link yet - tap Make a new link"}),(0,m.jsxs)(d.Muted,{center:!0,size:13,children:[ne," has no working link. Make one for the phone they use, then Share it privately."]})]}):null,ee&&ie>0&&0===te.length?(0,m.jsxs)(d.Muted,{center:!0,testID:`invite-hidden-${e.id}`,children:[ne," has ",1===ie?'a working link':`${ie} working links`," sent earlier. For safety it can\u2019t be shown again here. Tap Make a new link only if ",ne," needs a new one."]}):null,te.map(t=>{const s=H(t),o=ee[t],h=(0,c.personalAppUrl)(t,o);return(0,m.jsxs)(l.default,{testID:`invite-${t}-${e.id}`,style:{gap:6,padding:10,borderRadius:10,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.bg,alignItems:'center'},children:[(0,m.jsx)(d.T,{center:!0,weight:"semibold",children:s}),(0,m.jsx)(n.Text,{selectable:!0,accessibilityLabel:`${e.name}, ${s} personal link`,testID:`invite-link-${t}-${e.id}`,style:{color:u.colours.goldLight,fontSize:14,textAlign:'center',width:'100%'},children:o.shortCode?`Short link: ${o.shortCode}`:"Secure personal link \u2014 Copy or Share"}),o.linked?(0,m.jsxs)(d.Muted,{center:!0,size:13,testID:`invite-linked-${t}-${e.id}`,children:["Already linked to ",ne,"\u2019s phone. Another phone that opens it is asked to see a manager."]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(d.Muted,{center:!0,size:13,children:B(t)}),(0,m.jsx)(d.Muted,{center:!0,size:13,children:"Works for good on the first phone that opens it."})]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Copy",kind:"secondary",style:{minHeight:44,minWidth:44},accessibilityLabel:`Copy ${e.name}'s ${s} link`,testID:`invite-copy-${t}-${e.id}`,onPress:async()=>Y(await(0,p.copyText)(R(h,e.name,t))?'Link and install steps copied':'Select and copy the link.')}),(0,m.jsx)(d.Button,{label:"Share",style:{minHeight:44,minWidth:44},accessibilityLabel:`Share ${e.name}'s ${s} link`,testID:`invite-share-${t}-${e.id}`,onPress:async()=>Y(await z(h,e.name,t))}),W?(0,m.jsx)(d.Button,{label:"Revoke link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${s} link`,onPress:()=>K(o.id)}):null]})]},t)}),J&&W?(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:"Confirm revoke link",accessibilityLabel:`Confirm revoke link for ${e.name}`,style:{minHeight:44},onPress:()=>{ae(J)}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",style:{minHeight:44},onPress:()=>K(null)})]}):null,F?(0,m.jsx)(d.T,{center:!0,size:14,children:F}):null,ee&&W?(0,m.jsx)(l.default,{testID:`invite-make-${e.id}`,style:{gap:8,alignItems:'center',width:'100%'},children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(d.T,{center:!0,size:15,testID:`invite-make-ask-${e.id}`,children:["Make a new link for ",ne,"? Which phone do they use? ",se]}),(0,m.jsxs)(d.Row,{gap:8,wrap:!0,style:{justifyContent:'center'},children:[(0,m.jsx)(d.Button,{label:'android'===Z?'Making\u2026':'Android phone',testID:`invite-make-android-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new Android link for ${e.name}`,onPress:()=>{re('android')}}),(0,m.jsx)(d.Button,{label:'iphone'===Z?'Making\u2026':'iPhone',testID:`invite-make-iphone-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:`Yes, make a new iPhone link for ${e.name}`,onPress:()=>{re('iphone')}}),(0,m.jsx)(d.Button,{label:"Cancel",kind:"ghost",testID:`invite-make-cancel-${e.id}`,disabled:!!Z,style:{minHeight:48},accessibilityLabel:"Cancel, make no link",onPress:()=>G(!1)})]})]}):(0,m.jsx)(d.Button,{label:"Make a new link",kind:0===ie?'primary':'secondary',testID:`invite-new-${e.id}`,style:{minHeight:52,alignSelf:'center'},accessibilityLabel:`Make a new link for ${e.name}. Asks which phone first.`,onPress:()=>{Y(''),G(!0)}})}):null,ee&&!W?(0,m.jsx)(d.Muted,{center:!0,size:13,testID:`invite-make-managers-only-${e.id}`,children:"Only a manager or owner can make a new link."}):null,(0,m.jsxs)(d.Muted,{center:!0,size:13,children:["Share privately with ",e.name,". Links never expire. Opening this page never makes a link. Each link works on the first phone that opens it; Reset phone lets it link to a new one."]}),(0,m.jsx)(d.Button,{label:Q?'Hide previous links':'Manage previous links',kind:"ghost",style:{minHeight:44},accessibilityLabel:`Manage all previous app links for ${e.name}`,onPress:async()=>{try{q(Q?null:await(0,h.staffAppLinkHistory)(e.id))}catch(e){Y(String(e.message))}}}),Q?.map(n=>(0,m.jsxs)(l.default,{style:{gap:4},children:[(0,m.jsxs)(d.Muted,{center:!0,size:13,children:['legacy'===n.platform?'Previous app link':'android'===n.platform?'Android app':'iPhone'," \xb7 ",C(n.createdAt)," \xb7 ",n.revokedAt?'Revoked':n.usedAt?'Used for sign-in':'Unused']}),!n.revokedAt&&W?(0,m.jsx)(d.Button,{label:"Revoke this link",kind:"ghost",style:{minHeight:44},accessibilityLabel:`Revoke ${e.name}'s ${n.platform} link from ${C(n.createdAt)}`,onPress:()=>K(n.id)}):null]},n.id))]})};var e=r(_d[0]),n=r(_d[1]),t=r(_d[2]);r(_d[3]),r(_d[4]);var s,o=r(_d[5]),l=(s=o)&&s.__esModule?s:{default:s},d=r(_d[6]),c=r(_d[7]),h=r(_d[8]),u=r(_d[9]),p=r(_d[10]),k=r(_d[11]),y=r(_d[12]),f=r(_d[13]),m=r(_d[14]);const w=new Map,b=new Map,$=new Set,v=new Map,x=()=>$.forEach(e=>e());let j=null;const S=()=>j;let I={};async function P(){return I=await(0,h.staffLinkPhones)(),x(),I}function L(e){if(!e||!e.phones)return null;const n=new Date(e.since).toLocaleDateString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',year:'numeric'});return e.phones>1?`Linked to ${e.phones} phones, the first since ${n}`:`Linked to a phone since ${n}`}async function A(){return j=await(0,h.readInviteStatus)(),x(),j}const C=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}):'';async function M(n,t){if(e.PITCH)return void(w.has(n)||(w.set(n,{working:0}),x()));if(b.has(n))return b.get(n);const s=(async()=>{try{w.set(n,await(0,h.currentStaffAppLinks)(t)),v.delete(n)}catch(e){v.set(n,String(e.message||e))}finally{b.delete(n),x()}})();return b.set(n,s),s}async function D(n,t,s){if(e.PITCH){const e=w.get(n)??{},o=(e.working??0)+1,l={id:`qa-${s}-${t}-${o}`,token:('android'===s?'A':'B').repeat(32),device:'iphone'===s?'D'.repeat(32):null,app:'staff',expiresAt:'infinity',shortCode:('android'===s?'A':'I')+String(o).padStart(9,'0')},d={...e,[s]:l,working:o};return w.set(n,d),x(),d}const o=await(0,h.makeStaffAppLink)(t,s);return w.set(n,o),v.delete(n),x(),o}const H=e=>'android'===e?'Android app':'iPhone web app',T=e=>!!e&&('infinity'===e.expiresAt?/^[A-Za-z0-9_-]{16,64}$/.test(e.token):(0,c.currentAppLink)(e)),B=e=>'android'===e?'Tap the link, download the app, allow installation, then open it. It signs you in.':'Open in Safari and tap Open app. In the app, tap Share, Add to Home Screen, then open it from your Home Screen.',R=(e,n,t)=>`${n} \u2014 ${'android'===t?'Android app':'iPhone web app'}\n${e}\n${B(t)}`;async function z(e,n,t){const s=R(e,n,t);try{if('undefined'!=typeof navigator&&navigator.share)return await navigator.share({title:`CoverCharge for ${n}`,text:s,url:e}),'Share opened'}catch(e){if('AbortError'===e.name)return'Share cancelled'}return await(0,p.copyText)(s)?'Link and install steps copied. Paste them into a private message.':'Select and copy the link.'}},1456,[880,812,17,219,366,85,777,1457,899,804,1182,920,876,909,8]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IOS_WEB",{enumerable:!0,get:function(){return t}}),e.getPageSlug=n,e.personalGetUrl=o,e.siteRootFromLocation=s,e.mintPersonalUrl=function(t,c,h){const p=s();if(p)return o({origin:p.origin,basePath:p.basePath,staffId:t,name:c,token:h});return`get/${n(c)||n(t)}.html?v=2#i=${encodeURIComponent(h)}`},e.currentAppLink=function(t,n=Date.now()){return!!t&&/^[A-Za-z0-9_-]{16,64}$/.test(t.token)&&Date.parse(t.expiresAt)>n},e.personalAppUrl=function(t,n){if(n.shortCode&&/^[A-Za-z0-9_-]{10}$/.test(n.shortCode)){const t=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'};return`${t.origin}${t.basePath}s.html#${n.shortCode}`}if(n.url)try{const t=new URL(n.url);if('https:'===t.protocol&&'covercharge-apps.static.hf.space'===t.hostname&&/^\/(?:(?:kirkmichael|wildings)\/)?get\/[a-z0-9-]+\.html$/.test(t.pathname))return t.href}catch{}const o=s()??{origin:'https://covercharge-apps.static.hf.space',basePath:'/'},c=['owner','chef'].includes(n.app)?n.app:'staff',h=`i=${encodeURIComponent(n.token)}${'iphone'===t?`&d=${encodeURIComponent(n.device||'')}`:''}`;return`${o.origin}${o.basePath}get/${t}.html?a=${c}${'android'===t?'&v=2':'&v=61'}#${h}`};const t=new Set(['st-jack','st-agate','st-lenny','st-james','st-lillie','st-bisto','st-gordon','st-cameron','st-mia','st-emily','st-gabrielle','st-harvey','st-tracy','st-eilidh','st-finn']);function n(t){return(t.startsWith('st-')||t.startsWith('ow-')||t.startsWith('ch-')?t.replace(/^(st|ow|ch)-/,''):t.replace(/\s*\(.*?\)\s*/g,' ').trim().split(/\s+/)[0]||t).toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'staff'}function o(t){const o=t.origin.replace(/\/$/,'');let s=(t.basePath||'/').replace(/\/?$/,'/');s.startsWith('/')||(s='/'+s);return`${o}${s}get/${n(t.name)||n(t.staffId)}.html?v=2#i=${encodeURIComponent(t.token)}`}function s(t){try{if(!(t||'undefined'!=typeof window&&window.location))return null;const n=new URL(t||window.location.href),o=n.pathname.match(/^(.*?\/)(?:owner|staff|chef|display|customer)-app(?:\/|$)/);return{origin:n.origin,basePath:o?o[1]:'/'}}catch{return null}}},1457,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useFonts",{enumerable:!0,get:function(){return o.useFonts}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var o=r(d[2])},1458,[1459,1482,1484]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FontDisplay",{enumerable:!0,get:function(){return y.FontDisplay}}),_e.isLoaded=F,_e.getLoadedFonts=function(){return t.default.getLoadedFonts()},_e.isLoading=function(e){return e in c.loadPromises},_e.loadAsync=function(e,n){const t='undefined'==typeof window;if(Array.isArray(e)){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e;if(t){(0,l.assertValidFontFamilyDefinitions)(s);for(const{fontFamily:e,fontDefinitions:o}of s){(0,l.assertValidFontFaces)(e,o);for(const n of o)(0,u.registerStaticFont)(e,(0,f.fontSourceFromFace)(n))}return Promise.resolve()}try{(0,l.assertValidFontFamilyDefinitions)(s)}catch(e){return Promise.reject(e)}return Promise.all(s.map(w)).then(()=>{})}if('object'==typeof e){if(n)return Promise.reject(new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided source: ${n}. The second argument of \`loadAsync()\` can only be used with a \`string\` value as the first argument.`));const s=e,l=Object.keys(s);return t?(l.map(e=>(0,u.registerStaticFont)(e,s[e])),Promise.resolve()):Promise.all(l.map(e=>h(e,s[e]))).then(()=>{})}if(t)return(0,u.registerStaticFont)(e,n),Promise.resolve();return h(e,n)},_e.unloadAllAsync=async function(){if(!t.default.unloadAllAsync)throw new o.UnavailabilityError('expo-font','unloadAllAsync');if(Object.keys(c.loadPromises).length)throw new o.CodedError("ERR_UNLOAD",`Cannot unload fonts while they're still loading: ${Object.keys(c.loadPromises).join(', ')}`);(0,c.purgeCache)(),await t.default.unloadAllAsync()},_e.unloadAsync=async function(e,n){if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');if('object'==typeof e){if(n)throw new o.CodedError("ERR_FONT_API",`No fontFamily can be used for the provided options: ${n}. The second argument of \`unloadAsync()\` can only be used with a \`string\` value as the first argument.`);const t=e,s=Object.keys(t);return void await Promise.all(s.map(e=>p(e,t[e])))}return await p(e,n)};var e,o=r(d[0]),n=r(d[1]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]),f=r(d[4]),c=r(d[5]),u=r(d[6]),y=r(d[7]);function F(e){if('function'!=typeof t.default.isLoaded)throw new Error("expected ExpoFontLoader.isLoaded to be a function, was "+typeof t.default.isLoaded);return(0,c.isLoadedInCache)(e)||t.default.isLoaded(e)}async function w(e){const{fontFamily:o,fontDefinitions:n}=e;if((0,l.assertValidFontFaces)(o,n),c.loadPromises.hasOwnProperty(o))return c.loadPromises[o];F(o)||(c.loadPromises[o]=(async()=>{try{await(0,s.loadFontFamilyAsync)(o,n),(0,c.markLoaded)(o)}finally{delete c.loadPromises[o]}})(),await c.loadPromises[o])}async function h(e,n){if(!n)throw new o.CodedError("ERR_FONT_SOURCE",`Cannot load null or undefined font source: { "${e}": ${n} }. Expected asset of type \`FontSource\` for fontFamily of name: "${e}"`);if(c.loadPromises.hasOwnProperty(e))return c.loadPromises[e];if(F(e))return;const t=(0,s.getAssetForSource)(n);c.loadPromises[e]=(async()=>{try{await(0,s.loadSingleFontAsync)(e,t),(0,c.markLoaded)(e)}finally{delete c.loadPromises[e]}})(),await c.loadPromises[e]}async function p(e,n){if(F(e)){if((0,c.purgeFontFamilyFromCache)(e),!e)throw new o.CodedError("ERR_FONT_FAMILY","Cannot unload an empty name");if(!t.default.unloadAsync)throw new o.UnavailabilityError('expo-font','unloadAsync');await t.default.unloadAsync(e,n)}}},1459,[198,1460,1463,1477,1478,1479,1480,1481]); +__d(function(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}},1460,[198,1461]); +__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}},1461,[1462]); +__d(function(g,r,i,a,m,e,d){},1462,[]); +__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)}},1463,[1464,198,1460,1477,1478]); +__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]}})})},1464,[1465,1466,1476]); +__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()}})}},1465,[1466,1470,1475]); +__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}}},1466,[198,355,1467,1471,1472,1473,1474,1470,1475]); +__d(function(g,r,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}},1467,[198,1468,322,263,1469,1470]); +__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])},1468,[487]); +__d(function(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}}},1469,[198,322]); +__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},1470,[]); +__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}},1471,[]); +__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}},1472,[]); +__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])},1473,[1471]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getLocalAssetUri=function(t,n){return null}},1474,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),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},1475,[355,1469]); +__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])},1476,[17,1466]); +__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}},1477,[1464,198]); +__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])},1478,[1464,1477]); +__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}},1479,[1460]); +__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])},1480,[198,1460,1463,1461]); +__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})({})},1481,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_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]))},1482,[198,37,1483]); +__d(function(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')},1483,[198]); +__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]}},1484,[17,1459]); +__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]}})})},1485,[1486]); +__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(){}},1486,[]); +__d(function(g,_r,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,u.useSync)(e=>'device'===e.kind&&!!e.venueId),s=(0,u.useSync)(e=>e.mode),[o,l]=(0,t.useState)(c.useSession.persist.hasHydrated()),[x,b]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{h.PITCH&&(globalThis.__pitchCarBoot=e=>b(!!e))},[]),(0,t.useEffect)(()=>{const e=c.useSession.persist.onFinishHydration(()=>l(!0));return c.useSession.persist.hasHydrated()&&l(!0),e},[]),o?h.PITCH&&x?(0,p.jsx)(T,{}):h.PITCH||e?null:s&&'connecting'!==s?(0,p.jsx)(I,{}):(0,p.jsx)(T,{}):(0,p.jsx)(r.default,{style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3}]})};var t=_r(d[0]),n=e(_r(d[1])),r=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]),y=_r(d[10]),b=_r(d[11]),f=_r(d[12]),p=_r(d[13]);let j=null,w=null;async function C(e){return!e&&w&&Date.now()-w.at<6e4&&new Date(w.r.expiresAt).getTime()-Date.now()>12e4?w.r:j||(j=(0,u.carPairStart)().then(e=>(e.ok&&(w={r:e,at:Date.now()}),e)).finally(()=>{j=null}),j)}function I(){const{width:e,height:c}=(0,s.default)(),[h,j]=(0,t.useState)(null),[w,I]=(0,t.useState)('starting'),[T,k]=(0,t.useState)(''),[D,M]=(0,t.useState)(0),S=(0,t.useRef)(!1),z=(0,t.useCallback)(async(e=!0)=>{if(S.current)return;S.current=!0,I('starting'),k('');const t=await C(e);if(S.current=!1,!t.ok)return I('error'),void k(t.error);j({id:t.requestId,code:t.code,until:new Date(t.expiresAt).getTime()}),I('waiting')},[]);(0,t.useEffect)(()=>{z(!1)},[]),(0,t.useEffect)(()=>{if(!h||'waiting'!==w)return;const e=setInterval(async()=>{M(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)))),R=h?.code??'',H=R?`${R.slice(0,3)} ${R.slice(3)}`:'\xb7\xb7\xb7 \xb7\xb7\xb7';return(0,p.jsx)(r.default,{testID:"car-pairing",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24}],children:(0,p.jsxs)(r.default,{style:{width:'100%',maxWidth:880,alignItems:'center',gap:c<820?10:16},children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:c<820?64:88}),(0,p.jsx)(o.T,{center:!0,size:28,weight:"semibold",accessibilityRole:"header",children:"The Anchorage \xb7 car screen"}),(0,p.jsx)(f.ParkedOnly,{}),'waiting'===w||'starting'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:18,colour:y.colours.muted,children:"Pair this car from your phone"}),(0,p.jsx)(r.default,{testID:"car-code",accessible:!0,accessibilityLabel:R?`Car code ${(0,b.spokenCode)(R)}`:'Making a code',accessibilityLiveRegion:"polite",style:{paddingHorizontal:32,paddingVertical:10,borderRadius:20,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:'rgba(201,162,74,0.10)'},children:(0,p.jsx)(o.T,{center:!0,size:P,weight:"bold",colour:y.colours.goldLight,style:{letterSpacing:P/8,lineHeight:1.2*P},children:H})}),R?(0,p.jsx)(o.Muted,{center:!0,children:`This code works for ${Math.max(1,Math.ceil((D||600)/60))} more minute${1===Math.ceil((D||600)/60)?'':'s'}.`}):null,(0,p.jsxs)(r.default,{testID:"car-steps",style:{gap:4,alignItems:'center'},children:[(0,p.jsx)(o.T,{center:!0,size:18,children:"1. On your phone, open CoverCharge for Managers."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"2. Go to More, then Car screen."}),(0,p.jsx)(o.T,{center:!0,size:18,children:"3. Type these 6 numbers and tap Approve. Only an owner can do this."})]}),(0,p.jsx)(r.default,{style:{flexDirection:'row',gap:12,flexWrap:'wrap',justifyContent:'center'},children:(0,p.jsx)(o.Button,{testID:"car-new-code",kind:"secondary",label:"New code",onPress:()=>{z()},style:{minHeight:64,minWidth:200}})})]}):'expired'===w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:22,weight:"semibold",colour:y.colours.goldLight,children:"That code has run out"}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Make a new code",onPress:()=>{z()},style:{minHeight:64,minWidth:280}})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(o.T,{center:!0,size:20,weight:"semibold",colour:y.colours.amber,children:"Couldn\u2019t make a code"}),(0,p.jsx)(o.Muted,{center:!0,children:T}),(0,p.jsx)(o.Button,{testID:"car-new-code",label:"Try again",onPress:()=>{z()},style:{minHeight:64,minWidth:240}})]}),T&&'error'!==w?(0,p.jsx)(o.T,{center:!0,colour:y.colours.amber,children:T}):null,(0,p.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."})]})})}function T(){const[e,s]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{const e=setTimeout(()=>s(!0),15e3);return()=>clearTimeout(e)},[]),(0,p.jsxs)(r.default,{testID:"car-boot",style:[n.default.absoluteFill,{backgroundColor:y.colours.bg,zIndex:1e3,alignItems:'center',justifyContent:'center',padding:24,gap:16}],children:[(0,p.jsx)(l.RestaurantLogo,{rid:x.VENUE_RID,size:72}),(0,p.jsxs)(r.default,{accessible:!0,accessibilityRole:'alert',accessibilityLiveRegion:"polite",accessibilityLabel:e?'Still connecting. Check the car has mobile data or Wi-Fi, or tap Reload.':'The Anchorage car screen. Connecting\u2026',children:[(0,p.jsx)(o.T,{center:!0,size:24,weight:"semibold",children:e?'Still connecting\u2026':'Connecting\u2026'}),e?(0,p.jsx)(o.Muted,{center:!0,children:"Check the car has mobile data or Wi-Fi, or tap Reload."}):null]}),e?(0,p.jsx)(o.Button,{testID:"car-boot-reload",label:"Reload",onPress:()=>{try{location.reload()}catch{}},style:{minHeight:64,minWidth:220}}):null]})}},1487,[17,24,85,409,777,857,920,899,880,805,804,1488,1489,8]); +__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 o}}),Object.defineProperty(e,"MENU_BUTTON",{enumerable:!0,get:function(){return l}}),e.menuSizes=function(o,l){const s=Math.round(Math.max(300,Math.min(o-24,o>=1600?520:o>=1200?460:420))),t=Math.floor((s-40-2)/3),n=Math.floor(Math.max(84,(l-72-40)/4)),c=l>=1e3?15:13,b=Math.round(1.4*c),h=Math.max(52,Math.min(76,n-b-18,t-28));return{panelW:s,colW:t,per:n,circle:h,label:c,lineH:b,icon:Math.round(.44*h),cols:3,rows:4,head:72,pad:20}},Object.defineProperty(e,"spokenCode",{enumerable:!0,get:function(){return s}});const o=[{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:'kitchencosts',label:'Deliveries & GP'},{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:'CookSafe log'}]},{id:'reviews',label:'Reviews',short:'Reviews',icon:'reviews',pages:[{id:'reviews',label:'Reviews'}]}],l=56;const s=o=>o.split('').join(' ')},1488,[]); +__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])},1489,[17,85,777,804,8]); +__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()})},1490,[905,868,867,899]); +__d(function(g,r,i,a,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 C}}),Object.defineProperty(_e,"SYNC_CONNECTED_GREEN",{enumerable:!0,get:function(){return I}}),_e.syncTone=S,Object.defineProperty(_e,"syncToneColour",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"syncToneSpoken",{enumerable:!0,get:function(){return R}}),_e.SyncBadge=function(){const e=(0,h.useSync)(),[I,k]=(0,s.useState)(!1),[A,$]=(0,s.useState)(e.refused?.at??''),P=e.refused&&e.refused.at!==A?e.refused:void 0,z=(0,p.useScreensaverAsleep)(e=>e.asleep),[W,L]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{const e=setInterval(()=>L(Date.now()),5e3);return()=>clearInterval(e)},[]);const N='off'===e.mode&&(x.PITCH||!(0,v.isSupabaseConfigured)());if('customer'===u.APP_VARIANT||'off'===e.mode&&!N)return null;if(z)return(0,w.jsx)(c.default,{testID:"sync-strip-asleep",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{height:C,backgroundColor:f.colours.bg}});const O=!N&&!!e.venueId&&('live'===e.mode||'offline'===e.mode)&&(e.lastServerAt?(0,o.syncStale)(e.lastServerAt,W):'offline'===e.mode),H=e.lastServerAt?new Date(e.lastServerAt).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'',_='live'===e.mode&&!O,E=e.waiting??0,B=`${E} change${1===E?'':'s'} waiting to save`,G=O?'Out of sync':N?x.PITCH?'Demo \xb7 this device only':'This device only':_?E?B: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',M=O?'disconnected':S(e.mode,N,E),F=D(M),V=O?`Out of sync: nothing from the shared system since ${H||'this app opened'}. Reconnecting by itself; changes made here are kept and sent when it is back.`:N?x.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.':_?`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,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(c.default,{testID:"sync-strip",style:{height:C,paddingHorizontal:10,flexDirection:'row',gap:10,alignItems:'center',justifyContent:'flex-start',backgroundColor:f.colours.bg,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,w.jsxs)(l.default,{testID:"sync-badge",accessibilityRole:"button",accessibilityLabel:E&&_?`${B}, ${R(M)}. Kept on this device and tried again by itself. Tap for details.`:`${G}, ${R(M)}. 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:`${F}80`,maxWidth:320},children:[(0,w.jsx)(c.default,{testID:"sync-dot",style:{width:10,height:10,borderRadius:5,backgroundColor:F}}),(0,w.jsx)(b.T,{size:12,weight:"semibold",children:G})]}),O?(0,w.jsx)(c.default,{testID:"sync-out-banner",accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{flexShrink:1,flexDirection:'row',alignItems:'center',gap:8,paddingHorizontal:14,minHeight:40,borderRadius:10,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red},children:(0,w.jsx)(b.T,{size:13,weight:"semibold",numberOfLines:1,children:"Out of sync, reconnecting\u2026"+(H?` Last synced ${H}`:'')})}):null]}),I?(0,w.jsxs)(c.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,w.jsx)(b.T,{size:13,children:V}),E?(0,w.jsxs)(c.default,{testID:"sync-waiting",style:{gap:4},children:[(0,w.jsxs)(b.T,{size:12,colour:f.colours.gold,children:[B,". ",1===E?'It is':'They are'," kept on this device and tried again by ",1===E?'itself':'themselves'," until the shared system takes ",1===E?'it':'them',".",e.waitingWhat?` Waiting: ${e.waitingWhat}.`:'']}),(0,w.jsx)(l.default,{testID:"sync-retry",accessibilityRole:"button",accessibilityLabel:"Try saving again now",onPress:()=>{y.mutationQueue.retryNow()},style:{minHeight:44,justifyContent:'center',alignSelf:'flex-start',paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:f.colours.gold},children:(0,w.jsx)(b.T,{size:12,colour:f.colours.gold,children:"Try again now"})})]}):null,e.refused?(0,w.jsxs)(b.T,{size:12,colour:f.colours.red,children:["Last change not saved: ",e.refused.what,". ",e.refused.why,"."]}):null,e.message?(0,w.jsx)(b.T,{size:12,colour:f.colours.muted,children:e.message}):null,(0,w.jsx)(T.SyncDeviceActions,{})]}):null,P?(0,w.jsx)(c.default,{testID:"sync-toast",style:{position:'absolute',left:16,right:16,bottom:C+j+8,zIndex:950,alignItems:'center'},pointerEvents:"box-none",children:(0,w.jsxs)(c.default,{accessibilityRole:"alert",accessibilityLiveRegion:"assertive",style:{padding:12,borderRadius:12,backgroundColor:'#3A1712',borderWidth:1,borderColor:f.colours.red,maxWidth:460,gap:8},children:[(0,w.jsx)(b.T,{size:13,children:`Not saved: ${P.what}. Why: ${P.why}. This device now shows what the shared system has, so please make the change again if it is still needed.`}),(0,w.jsx)(n.ToastClose,{testID:"sync-toast-ok",label:"Close this message",onPress:()=>$(P.at),style:{minHeight:44,minWidth:44,alignSelf:'flex-end'}})]})}):null]})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),o=r(d[3]),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),h=r(d[7]),y=r(d[8]),f=r(d[9]),b=r(d[10]),p=r(d[11]),v=r(d[12]),x=r(d[13]),T=r(d[14]),w=r(d[15]);const C=48,j='display'===u.APP_VARIANT?0:57,I='#3DD68C';function S(e,t,n){return t?'disconnected':'live'===e?n?'pending':'connected':'connecting'===e?'pending':'disconnected'}const D=e=>'connected'===e?I:'pending'===e?f.colours.amber:f.colours.red,R=e=>'connected'===e?'connected':'pending'===e?'not connected yet':'not connected'},1491,[813,779,17,974,385,85,856,899,976,804,777,1346,971,880,1492,8]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SyncDeviceActions=function(){const e=(0,o.useSync)(),[f,p]=(0,s.useState)(!1),h='live'===e.mode||'offline'===e.mode;return e.venueId&&h?(0,b.jsxs)(b.Fragment,{children:[f?(0,b.jsxs)(c.default,{style:{gap:6,marginTop:6},children:[(0,b.jsx)(u.T,{size:12,children:"Disconnect this device? Your changes stay on it; open your personal invite link to connect again."}),(0,b.jsxs)(c.default,{style:{flexDirection:'row',gap:8},children:[(0,b.jsx)(t.default,{testID:"unpair-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, disconnect",onPress:()=>{p(!1),(0,o.disconnectStaff)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:l.colours.red},children:(0,b.jsx)(u.T,{size:12,weight:"semibold",children:"Yes, disconnect"})}),(0,b.jsx)(t.default,{accessibilityRole:"button",accessibilityLabel:"Keep connected",onPress:()=>p(!1),style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,b.jsx)(u.T,{size:12,children:"Keep"})})]})]}):(0,b.jsx)(t.default,{testID:"unpair",accessibilityRole:"button",accessibilityLabel:"Disconnect this device",onPress:()=>p(!0),style:{marginTop:6,alignSelf:'flex-start'},children:(0,b.jsx)(u.T,{size:12,colour:l.colours.gold,children:"Disconnect this device\u2026"})}),(0,b.jsx)(n.WipeDevice,{compact:!0})]}):null};var s=r(d[0]),n=r(d[1]),t=e(r(d[2])),c=e(r(d[3])),o=r(d[4]),l=r(d[5]),u=r(d[6]),b=r(d[7])},1492,[17,1416,385,85,899,804,777,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.seedPitch=function(){}},1493,[]); +__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"},1494,[]); +__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"},1495,[]); +__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"},1496,[]); +__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"},1497,[]); +__d(function(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]})}},1498,[13,17,856,8]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return 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},1499,[1500]); +__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},1500,[8,1501,574]); +__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}))}}},1501,[17,155]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1502,[]); +__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})}}},1503,[8,482,17,253,634]); __r(484); __r(4); __r(0); \ No newline at end of file diff --git a/staff-app/admin.html b/staff-app/admin.html index d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 9544d3d36590bdb231e4ca05a8b6ef05eceff9f0..41e7e6556f5501a304f95b24686025bf35589a1d 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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 3e6ce0cb52bcd924be23dff3b342de59013454d0..525fa64ed6a690f0cc778f0fbdc56e3c81f55085 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-9c813c20aa"; +const V = "cc-staff-a10577da74"; const BASE = "/staff-app/"; -const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=9c813c20aa42461ec43d00b70180f47223a11417eefc6bebc87ec2d0bc6a9230"]; +const PRECACHE = ["/staff-app/apple-touch-icon.png", "/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/staff-app/brand-logo.png", "/staff-app/favicon.ico", "/staff-app/icon-192.png", "/staff-app/icon-512.png", "/staff-app/icon-maskable-192.png", "/staff-app/icon-maskable-512.png", "/staff-app/manifest.webmanifest", "/staff-app/index.html", "/staff-app/_expo/static/js/web/bundle.js?v=a10577da7483140da4e67c6fdb865a62e0ca6016e9f2a0271fc191f2653cbcdb"]; // 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 d05b6526bda6b7e6d26d825addafce8ca55c480b..0a93c6d4f43a361bdd9a19cb43f15e33b7a2d7ce 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); })(); - +